Add genex support to TEST_LAUNCHER and CROSSCOMPILING_EMULATOR

Evaluate generator expressions in these properties, as they apply to
`add_test`, `add_custom_command`, and `add_custom_target`.

The `CMAKE_CROSSCOMPILING_EMULATOR` variable's `try_run` behavior occurs
at configure time and so cannot support generator expressions.
This commit is contained in:
Brad King
2024-01-26 15:16:46 -05:00
parent b9ad73fcb2
commit 13ece67a58
23 changed files with 162 additions and 59 deletions

View File

@@ -19,5 +19,8 @@ for the target system.
The command will be used to run :command:`try_run` generated executables,
which avoids manual population of the ``TryRunResults.cmake`` file.
It is also used as the default value for the
:prop_tgt:`CROSSCOMPILING_EMULATOR` target property of executables.
This variable is also used as the default value for the
:prop_tgt:`CROSSCOMPILING_EMULATOR` target property of executables. However,
while :manual:`generator expressions <cmake-generator-expressions(7)>` are
supported by the target property (since CMake 3.29), they are *not* supported
by this variable's :command:`try_run` functionality.

View File

@@ -3,14 +3,14 @@ CMAKE_TEST_LAUNCHER
.. versionadded:: 3.29
This variable is used to specify a launcher for running tests, added
by the :command:`add_test` command, that run an executable target.
This variable is used to initialize the :prop_tgt:`TEST_LAUNCHER` target
property of executable targets as they are created. It is used to specify
a launcher for running tests, added by the :command:`add_test` command,
that run an executable target.
If this variable contains a :ref:`semicolon-separated list <CMake Language
Lists>`, then the first value is the command and remaining values are its
arguments.
This variable can be initialized via an
:envvar:`CMAKE_TEST_LAUNCHER` environment variable.
It is also used as the default value for the
:prop_tgt:`TEST_LAUNCHER` target property of executables.