Help: Clarify when add_test and test properties support generator expressions

Issue: #23329
This commit is contained in:
Brad King
2022-03-21 15:43:30 -04:00
parent 58f15afb8a
commit 78e0204e81
3 changed files with 26 additions and 8 deletions

View File

@@ -20,6 +20,9 @@ if necessary. See policy :policy:`CMP0110`. The options are:
automatically be replaced by the location of the executable created
at build time.
The command may be specified using
:manual:`generator expressions <cmake-generator-expressions(7)>`.
``CONFIGURATIONS``
Restrict execution of the test only to the named configurations.
@@ -30,6 +33,9 @@ if necessary. See policy :policy:`CMP0110`. The options are:
directory set to the build directory corresponding to the
current source directory.
The working directory may be specified using
:manual:`generator expressions <cmake-generator-expressions(7)>`.
``COMMAND_EXPAND_LISTS``
.. versionadded:: 3.16
@@ -48,9 +54,10 @@ unless the :prop_test:`PASS_REGULAR_EXPRESSION`,
.. versionadded:: 3.16
Added :prop_test:`SKIP_REGULAR_EXPRESSION` property.
The ``COMMAND`` and ``WORKING_DIRECTORY`` options may use "generator
expressions" with the syntax ``$<...>``. See the
:manual:`cmake-generator-expressions(7)` manual for available expressions.
Tests added with the ``add_test(NAME)`` signature support using
:manual:`generator expressions <cmake-generator-expressions(7)>`
in test properties set by :command:`set_property(TEST)` or
:command:`set_tests_properties`.
Example usage:
@@ -73,10 +80,15 @@ file produced by target ``myexe``.
---------------------------------------------------------------------
This command also supports a simpler, but less flexible, signature:
.. code-block:: cmake
add_test(<name> <command> [<arg>...])
Add a test called ``<name>`` with the given command-line. Unlike
the above ``NAME`` signature no transformation is performed on the
command-line to support target names or generator expressions.
Add a test called ``<name>`` with the given command-line.
Unlike the above ``NAME`` signature, target names are not supported
in the command-line. Furthermore, tests added with this signature do not
support :manual:`generator expressions <cmake-generator-expressions(7)>`
in the command-line or test properties.

View File

@@ -85,6 +85,10 @@ It must be one of the following:
Scope may name zero or more existing tests.
See also the :command:`set_tests_properties` command.
Test property values may be specified using
:manual:`generator expressions <cmake-generator-expressions(7)>`
for tests created by the :command:`add_test(NAME)` signature.
``CACHE``
Scope must name zero or more cache existing entries.

View File

@@ -9,8 +9,10 @@ Set a property of the tests.
Sets a property for the tests. If the test is not found, CMake
will report an error.
:manual:`Generator expressions <cmake-generator-expressions(7)>` will be
expanded the same as supported by the test's :command:`add_test` call.
Test property values may be specified using
:manual:`generator expressions <cmake-generator-expressions(7)>`
for tests created by the :command:`add_test(NAME)` signature.
See also the :command:`set_property(TEST)` command.