execute_process.rst 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. execute_process
  2. ---------------
  3. Execute one or more child processes.
  4. ::
  5. execute_process(COMMAND <cmd1> [args1...]]
  6. [COMMAND <cmd2> [args2...] [...]]
  7. [WORKING_DIRECTORY <directory>]
  8. [TIMEOUT <seconds>]
  9. [RESULT_VARIABLE <variable>]
  10. [OUTPUT_VARIABLE <variable>]
  11. [ERROR_VARIABLE <variable>]
  12. [INPUT_FILE <file>]
  13. [OUTPUT_FILE <file>]
  14. [ERROR_FILE <file>]
  15. [OUTPUT_QUIET]
  16. [ERROR_QUIET]
  17. [OUTPUT_STRIP_TRAILING_WHITESPACE]
  18. [ERROR_STRIP_TRAILING_WHITESPACE])
  19. Runs the given sequence of one or more commands with the standard
  20. output of each process piped to the standard input of the next. A
  21. single standard error pipe is used for all processes. If
  22. WORKING_DIRECTORY is given the named directory will be set as the
  23. current working directory of the child processes. If TIMEOUT is given
  24. the child processes will be terminated if they do not finish in the
  25. specified number of seconds (fractions are allowed). If
  26. RESULT_VARIABLE is given the variable will be set to contain the
  27. result of running the processes. This will be an integer return code
  28. from the last child or a string describing an error condition. If
  29. OUTPUT_VARIABLE or ERROR_VARIABLE are given the variable named will be
  30. set with the contents of the standard output and standard error pipes
  31. respectively. If the same variable is named for both pipes their
  32. output will be merged in the order produced. If INPUT_FILE,
  33. OUTPUT_FILE, or ERROR_FILE is given the file named will be attached to
  34. the standard input of the first process, standard output of the last
  35. process, or standard error of all processes respectively. If
  36. OUTPUT_QUIET or ERROR_QUIET is given then the standard output or
  37. standard error results will be quietly ignored. If more than one
  38. OUTPUT_* or ERROR_* option is given for the same pipe the precedence
  39. is not specified. If no OUTPUT_* or ERROR_* options are given the
  40. output will be shared with the corresponding pipes of the CMake
  41. process itself.
  42. The execute_process command is a newer more powerful version of
  43. exec_program, but the old command has been kept for compatibility.