diff options
Diffstat (limited to 'Help/command/try_run.rst')
-rw-r--r-- | Help/command/try_run.rst | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst index d401ebe..404de98 100644 --- a/Help/command/try_run.rst +++ b/Help/command/try_run.rst @@ -20,6 +20,7 @@ Try Compiling and Running Source Files [COMPILE_OUTPUT_VARIABLE <var>] [RUN_OUTPUT_VARIABLE <var>] [OUTPUT_VARIABLE <var>] + [WORKING_DIRECTORY <var>] [ARGS <args>...]) Try compiling a ``<srcfile>``. Returns ``TRUE`` or ``FALSE`` for success @@ -29,6 +30,11 @@ executable was built, but failed to run, then ``<runResultVar>`` will be set to ``FAILED_TO_RUN``. See the :command:`try_compile` command for information on how the test project is constructed to build the source file. +.. versionadded:: 3.14 + The names of the result variables ``<runResultVar>`` and + ``<compileResultVar>`` are defined by the user. Previously, they had + fixed names ``RUN_RESULT_VAR`` and ``COMPILE_RESULT_VAR``. + The options are: ``CMAKE_FLAGS <flags>...`` @@ -46,6 +52,8 @@ The options are: Report the compile step build output in a given variable. ``LINK_LIBRARIES <libs>...`` + .. versionadded:: 3.2 + Specify libraries to be linked in the generated project. The list of libraries may refer to system libraries and to :ref:`Imported Targets <Imported Targets>` from the calling project. @@ -54,6 +62,8 @@ The options are: given to the ``CMAKE_FLAGS`` option will be ignored. ``LINK_OPTIONS <options>...`` + .. versionadded:: 3.14 + Specify link step options to pass to :command:`target_link_options` in the generated project. @@ -65,6 +75,12 @@ The options are: ``RUN_OUTPUT_VARIABLE <var>`` Report the output from running the executable in a given variable. +``WORKING_DIRECTORY <var>`` + .. versionadded:: 3.20 + + Run the executable in the given directory. If no ``WORKING_DIRECTORY`` is + specified, the executable will run in ``<bindir>``. + Other Behavior Settings ^^^^^^^^^^^^^^^^^^^^^^^ @@ -74,6 +90,10 @@ a build configuration. Behavior when Cross Compiling ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.3 + Use ``CMAKE_CROSSCOMPILING_EMULATOR`` when running cross-compiled + binaries. + When cross compiling, the executable compiled in the first step usually cannot be run on the build host. The ``try_run`` command checks the :variable:`CMAKE_CROSSCOMPILING` variable to detect whether CMake is in |