mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-06 15:50:56 +00:00
Makefile: Generate test_prep targets for CMAKE_TEST_BUILD_DEPENDS
Extend the test_prep/<test> and test_prep/all build targets, generated from add_test(BUILD_DEPENDS) when CMAKE_TEST_BUILD_DEPENDS is enabled, to the Makefile generators. Previously only the Ninja and FASTBuild generators provided them. Resolve each test's dependencies in a shared layer so all command-line generators consume one result. cmTestGenerator now filters target dependencies to build-system targets and records, for each file dependency, the single target that produces it as a primary custom-command output (cmGlobalGenerator::FindOutputOwningTarget). The Makefile generators emit phony rules in CMakeFiles/Makefile2 depending on <target>.dir/all, with top-level forwarding rules. Sharing the resolution also stops Ninja and FASTBuild from emitting a dead test_prep edge for a non-buildable (e.g. INTERFACE) BUILD_DEPENDS target. On the Makefile generators a file dependency that no single target produces, and a test whose name contains ':', cannot be expressed as a recursive-make rule and are reported with a warning and skipped. Fixes: #27879
This commit is contained in:
@@ -82,7 +82,12 @@ directory the test is created in.
|
||||
|
||||
.. versionchanged:: 4.5
|
||||
|
||||
:generator:`FASTBuild` gained support for ``test_prep/<name>`` targets.
|
||||
:generator:`FASTBuild` and the :ref:`Makefile Generators` gained support
|
||||
for ``test_prep/<name>`` targets. With the Makefile generators a
|
||||
``BUILD_DEPENDS`` file is built by building the target whose build
|
||||
produces it; a file that is not the unique output of a single target is
|
||||
reported with a warning, and a test whose name contains a ``:`` character
|
||||
is excluded.
|
||||
|
||||
The command may be specified using
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||
@@ -101,9 +106,10 @@ directory the test is created in.
|
||||
|
||||
Specify a list of targets or files that must be built before the test can
|
||||
run. Each dependency is added to the ``test_prep/<name>`` build target
|
||||
described above when :variable:`CMAKE_TEST_BUILD_DEPENDS` is enabled with
|
||||
the :ref:`Ninja Generators` or :generator:`FASTBuild`. The test name must be
|
||||
a valid target name in order to list build dependencies with this keyword.
|
||||
described above when :variable:`CMAKE_TEST_BUILD_DEPENDS` is enabled with the
|
||||
:ref:`Ninja Generators`, :generator:`FASTBuild`, or :ref:`Makefile
|
||||
Generators`. The test name must be a valid target name in order to list
|
||||
build dependencies with this keyword.
|
||||
|
||||
``COMMAND_EXPAND_LISTS``
|
||||
.. versionadded:: 3.16
|
||||
|
||||
Reference in New Issue
Block a user