Merge topic 'doc-exe-result'

c720e2a23d Help: Document execute_process(RESULT_VARIABLE) capture in source code guide

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12028
diff --git a/Help/dev/source.rst b/Help/dev/source.rst
index 046be1e..1144ee2 100644
--- a/Help/dev/source.rst
+++ b/Help/dev/source.rst
@@ -329,6 +329,15 @@
 A raw pointer **must** not be deleted. Only the object(s) owning the smart
 pointer are allowed to delete dynamically allocated memory.
 
+CMake Module/Script Style
+=========================
+
+``execute_process`` should capture ``RESULT_VARIABLE`` to avoid
+unexpected termination of CMake in case the user or project has set
+``CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL`` to a value other than
+``NONE``.  Output should be captured for both stdout and stderr by using
+``OUTPUT_VARIABLE``/``OUTPUT_QUIET`` and ``ERROR_VARIABLE``/``ERROR_QUIET``.
+
 Third Parties
 =============