Execute one or more child processes.
execute_process(COMMAND <cmd1> [<arguments>] [COMMAND <cmd2> [<arguments>]]... [WORKING_DIRECTORY <directory>] [TIMEOUT <seconds>] [RESULT_VARIABLE <variable>] [RESULTS_VARIABLE <variable>] [OUTPUT_VARIABLE <variable>] [ERROR_VARIABLE <variable>] [INPUT_FILE <file>] [OUTPUT_FILE <file>] [ERROR_FILE <file>] [OUTPUT_QUIET] [ERROR_QUIET] [COMMAND_ECHO <where>] [OUTPUT_STRIP_TRAILING_WHITESPACE] [ERROR_STRIP_TRAILING_WHITESPACE] [ENCODING <name>])
Runs the given sequence of one or more commands.
Commands are executed concurrently as a pipeline, with the standard output of each process piped to the standard input of the next. A single standard error pipe is used for all processes.
A child process command line.
CMake executes the child process using operating system APIs directly. All arguments are passed VERBATIM to the child process. No intermediate shell is used, so shell operators such as
> are treated as normal arguments. (Use the
ERROR_* options to redirect stdin, stdout, and stderr.)
If a sequential execution of multiple commands is required, use multiple
execute_process() calls with a single
RESULT_VARIABLEwill be set to a string mentioning the “timeout”.
COMMANDarguments. Each entry will be an integer return code from the corresponding child or a string describing an error condition.
INPUT_FILE, OUTPUT_FILE, ERROR_FILE
<where>being set to one of
NONE. See the
CMAKE_EXECUTE_PROCESS_COMMAND_ECHOvariable for a way to control the default behavior when this option is not present.
On Windows, the encoding that is used to decode output from the process. Ignored on other platforms. Valid encoding names are:
UTF8 or UTF-8
UTF8was accepted for this encoding. In CMake 3.11.0,
UTF-8was added for consistency with the UTF-8 RFC naming convention.
If more than one
ERROR_* option is given for the same pipe the precedence is not specified. If no
ERROR_* options are given the output will be shared with the corresponding pipes of the CMake process itself.
execute_process() command is a newer more powerful version of
exec_program(), but the old command has been kept for compatibility. Both commands run while CMake is processing the project prior to build system generation. Use
add_custom_command() to create custom commands that run at build time.
© 2000–2019 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.