2013-10-15 19:17:36 +04:00
|
|
|
execute_process
|
|
|
|
---------------
|
|
|
|
|
|
|
|
Execute one or more child processes.
|
|
|
|
|
2013-11-08 01:32:52 +04:00
|
|
|
.. code-block:: cmake
|
2013-10-15 19:17:36 +04:00
|
|
|
|
|
|
|
execute_process(COMMAND <cmd1> [args1...]]
|
|
|
|
[COMMAND <cmd2> [args2...] [...]]
|
|
|
|
[WORKING_DIRECTORY <directory>]
|
|
|
|
[TIMEOUT <seconds>]
|
|
|
|
[RESULT_VARIABLE <variable>]
|
|
|
|
[OUTPUT_VARIABLE <variable>]
|
|
|
|
[ERROR_VARIABLE <variable>]
|
|
|
|
[INPUT_FILE <file>]
|
|
|
|
[OUTPUT_FILE <file>]
|
|
|
|
[ERROR_FILE <file>]
|
|
|
|
[OUTPUT_QUIET]
|
|
|
|
[ERROR_QUIET]
|
|
|
|
[OUTPUT_STRIP_TRAILING_WHITESPACE]
|
|
|
|
[ERROR_STRIP_TRAILING_WHITESPACE])
|
|
|
|
|
|
|
|
Runs the given sequence of one or more commands with the standard
|
2013-11-08 01:32:52 +04:00
|
|
|
output of each process piped to the standard input of the next.
|
|
|
|
A single standard error pipe is used for all processes.
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
2015-06-05 00:51:22 +03:00
|
|
|
``COMMAND``
|
2013-11-08 01:40:15 +04:00
|
|
|
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 ``INPUT_*``, ``OUTPUT_*``, and ``ERROR_*`` options to
|
|
|
|
redirect stdin, stdout, and stderr.)
|
|
|
|
|
2015-06-05 00:51:22 +03:00
|
|
|
``WORKING_DIRECTORY``
|
2013-11-08 01:32:52 +04:00
|
|
|
The named directory will be set as the current working directory of
|
|
|
|
the child processes.
|
|
|
|
|
2015-06-05 00:51:22 +03:00
|
|
|
``TIMEOUT``
|
2013-11-08 01:32:52 +04:00
|
|
|
The child processes will be terminated if they do not finish in the
|
|
|
|
specified number of seconds (fractions are allowed).
|
|
|
|
|
2015-06-05 00:51:22 +03:00
|
|
|
``RESULT_VARIABLE``
|
2013-11-08 01:32:52 +04:00
|
|
|
The variable will be set to contain the result of running the processes.
|
|
|
|
This will be an integer return code from the last child or a string
|
|
|
|
describing an error condition.
|
|
|
|
|
2015-06-05 00:51:22 +03:00
|
|
|
``OUTPUT_VARIABLE``, ``ERROR_VARIABLE``
|
2013-11-08 01:32:52 +04:00
|
|
|
The variable named will be set with the contents of the standard output
|
|
|
|
and standard error pipes, respectively. If the same variable is named
|
|
|
|
for both pipes their output will be merged in the order produced.
|
|
|
|
|
2015-06-05 00:51:22 +03:00
|
|
|
``INPUT_FILE, OUTPUT_FILE``, ``ERROR_FILE``
|
2013-11-08 01:32:52 +04:00
|
|
|
The file named will be attached to the standard input of the first
|
|
|
|
process, standard output of the last process, or standard error of
|
2015-05-07 21:40:38 +03:00
|
|
|
all processes, respectively. If the same file is named for both
|
|
|
|
output and error then it will be used for both.
|
2013-11-08 01:32:52 +04:00
|
|
|
|
2015-06-05 00:51:22 +03:00
|
|
|
``OUTPUT_QUIET``, ``ERROR_QUIET``
|
2013-11-08 01:32:52 +04:00
|
|
|
The standard output or standard error results will be quietly ignored.
|
|
|
|
|
|
|
|
If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the
|
|
|
|
same pipe the precedence is not specified.
|
|
|
|
If no ``OUTPUT_*`` or ``ERROR_*`` options are given the output will
|
|
|
|
be shared with the corresponding pipes of the CMake process itself.
|
|
|
|
|
|
|
|
The :command:`execute_process` command is a newer more powerful version of
|
|
|
|
:command:`exec_program`, but the old command has been kept for compatibility.
|
2013-11-08 01:40:15 +04:00
|
|
|
Both commands run while CMake is processing the project prior to build
|
|
|
|
system generation. Use :command:`add_custom_target` and
|
|
|
|
:command:`add_custom_command` to create custom commands that run at
|
|
|
|
build time.
|