1
0

exec_program.rst 1.1 KB

123456789101112131415161718192021222324252627282930
  1. exec_program
  2. ------------
  3. .. versionchanged:: 3.28
  4. This command is available only if policy :policy:`CMP0153` is not set to ``NEW``.
  5. Port projects to the :command:`execute_process` command.
  6. .. deprecated:: 3.0
  7. Use the :command:`execute_process` command instead.
  8. Run an executable program during the processing of the CMakeList.txt
  9. file.
  10. .. code-block:: cmake
  11. exec_program(Executable [directory in which to run]
  12. [ARGS <arguments to executable>]
  13. [OUTPUT_VARIABLE <var>]
  14. [RETURN_VALUE <var>])
  15. The executable is run in the optionally specified directory. The
  16. executable can include arguments if it is double quoted, but it is
  17. better to use the optional ``ARGS`` argument to specify arguments to the
  18. program. This is because cmake will then be able to escape spaces in
  19. the executable path. An optional argument ``OUTPUT_VARIABLE`` specifies a
  20. variable in which to store the output. To capture the return value of
  21. the execution, provide a ``RETURN_VALUE``. If ``OUTPUT_VARIABLE`` is
  22. specified, then no output will go to the stdout/stderr of the console
  23. running cmake.