Commit Graph
2023 Commits
Author SHA1 Message Date
Brad King 517427ca1e Merge topic 'doxygen-defined-fix'
63e7673d0b FindDoxygen: Tolerate empty output formats
bc7346c06b Help/if: Fix indentation level of if(DEFINED)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12737
2026-10-30 10:14:32 -04:00
Tyler Yankee bc7346c06b Help/if: Fix indentation level of if(DEFINED) 2026-10-29 09:30:34 -04:00
Brad King 05aa370dd0 Merge topic 'codegen-noop-fix'
36fcfb3e01 Tests/RunCMake/Codegen: Extend coverage
fe95f96096 Ninja Multi-Config: Fix cross-config codegen target suffix
f54117c6b1 Ninja: Evaluate generator expressions in CODEGEN outputs
902ec85438 Makefile, Ninja: Fix no-op codegen builds with no CODEGEN
17de9500e8 Help: Clarify existing CODEGEN behavior

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Overchenko <aleksandr9809@gmail.com>
Merge-request: !12715
2026-10-26 15:21:42 -04:00
Tyler Yankee f54117c6b1 Ninja: Evaluate generator expressions in CODEGEN outputs
Codegen is supported for Ninja Multi-Config, so CODEGEN should support
generator expressions.
2026-10-25 19:52:43 -04:00
Tyler Yankee 902ec85438 Makefile, Ninja: Fix no-op codegen builds with no CODEGEN
Ninja: Since commit 2d85779126 (Ninja: Account for explicit target
dependencies via CODEGEN, 2026-09-15, v4.5.0-rc1~162^2), a directory's
codegen phony depends on the full build of every add_dependencies
target (which caused their non-CODEGEN commands to run). Instead,
depend only on those targets' CODEGEN outputs, and follow their own
codegen dependencies in turn.

Makefiles: Since commit 197cb419d1 (add_custom_command: Add CODEGEN
support, 2024-05-27, v3.31.0-rc1~394^2), a target's `<target>/codegen`
rule used to depend on `<dep>/all` for every add_dependencies target,
which fully built them. Instead, depend on `<dep>/codegen`, except when
the target has CODEGEN commands of its own, in which case it should
still depend on `<dep>/all` as the commands may need the dependency's
outputs.

Shape up the prior `no-codegen` test case, which wasn't verifying much
of anything.

Fixes: #28205
2026-10-25 19:52:43 -04:00
Tyler Yankee 17de9500e8 Help: Clarify existing CODEGEN behavior 2026-10-25 19:52:20 -04:00
AJIOB a443a9cbb8 Help: PARSE_ARGV start number was explicitly noted 2026-10-24 22:56:23 +03:00
Brad King 6f383662d5 Merge topic 'ctest_name_output_dir'
ad6be5a4dd CTest: Add an option to set the output directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12635
2026-10-23 09:38:48 -04:00
Brad King 6dec4c37d9 Merge topic 'custom-rule-callbacks-in-configure-step'
ccc15ac21c Custom rule: ensure user's callbacks are executed during config step

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12689
2026-10-23 09:22:43 -04:00
Marc Chevrier ccc15ac21c Custom rule: ensure user's callbacks are executed during config step 2026-10-22 23:10:38 +02:00
Tom Osika ad6be5a4dd CTest: Add an option to set the output directory
CTest writes the files it produces during a run -- the TAG file, the
logs under Temporary, and the XML files staged for submission -- into a
single directory, which was always "Testing" under the build tree.  Two
ctest processes sharing a build tree therefore overwrite each other's
output.

Add a --output-dir command-line option, and a CTEST_OUTPUT_DIRECTORY
variable for dashboard scripts, to select that directory.  It defaults
to the previous location, may be outside the build tree, and resolves a
relative path against the binary directory.

Issue: #27518
2026-10-22 18:17:33 +00:00
Mickaël Germain 4e3c9569b8 ctest_test: Honor CTEST_TEST_COVERAGE_TOOL in dashboard scripts
Since CMake 4.4 the `CTEST_TEST_COVERAGE_TOOL` variable is documented to
specify the `CoverageTool` setting in a ctest(1) dashboard client script,
but `ctest_test()` never read it.  Only the `COVERAGE_TOOL` argument and
the `CTestTestCoverageTool` entry of `DartConfiguration.tcl` had an
effect.

Now `ctest_test()` uses the variable when the `COVERAGE_TOOL` argument
is not given.  Like the other test step settings, such as
`CTEST_TEST_LOAD`, the argument takes priority over the variable, and
the variable takes priority over `DartConfiguration.tcl`.

Fixes: #28191
2026-10-19 21:49:10 -07:00
Brad King 491d4c74b5 Merge topic 'doc-custom-rule-fixes'
dddf9c11a3 Help/add_custom_rule: Fix a few typos

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12670
2026-10-19 13:30:40 -04:00
Brad King c4c146dc35 Merge topic 'doc-custom-rule-fixes' into release-4.5
dddf9c11a3 Help/add_custom_rule: Fix a few typos

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12670
2026-10-19 13:30:38 -04:00
Brad King 382f2e73e2 Merge topic 'custom_rule-output_file_set-enhancements'
8c0a8b0b4c custom rule: enhance output file set management

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12662
2026-10-19 13:22:29 -04:00
Tyler Yankee dddf9c11a3 Help/add_custom_rule: Fix a few typos 2026-10-18 07:58:08 -04:00
Michael Karcher 7c471bd7a2 add_custom_command: Document behavior of repeated calls for build events
Closes: #28182
2026-10-16 14:35:01 -04:00
Marc Chevrier 8c0a8b0b4c custom rule: enhance output file set management
* Add control over output file set BASE_DIRS
* Add patterns for output file set directories
2026-10-16 16:53:19 +02:00
Brad King 2918f600a2 Merge topic 'pch-warnings'
cec0ec5273 PCH: Add PCH_WARNINGS property to get warnings from precompiled headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12616
2026-10-16 10:29:09 -04:00
Brad King d2025fc8f0 Merge topic 'enable-test_prep-by-default'
4bbdabae74 Ninja, Makefile, FASTBuild: Enable test_prep by default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12638
2026-10-15 10:48:16 -04:00
Brad King 89fa36af1a Merge topic 'enable-test_prep-by-default' into release-4.5
4bbdabae74 Ninja, Makefile, FASTBuild: Enable test_prep by default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12638
2026-10-15 10:48:14 -04:00
Matthew Woehlke 4bbdabae74 Ninja, Makefile, FASTBuild: Enable test_prep by default
Enable test preparation targets by default. Add (better named)
`CMAKE_SKIP_TEST_PREP_TARGETS` variable to control generation of the
same, mirroring `CMAKE_SKIP_INSTALL_PREP_TARGETS`. Remove support for
old `CMAKE_TEST_BUILD_DEPENDS` variable. Update and improve
documentation.

This improves consistency between test and install preparation targets.
It also modifies the descriptions of preparation targets in the
documentation of generators which support them to be consistent.
(Previously, each generator described preparation targets in a manner
unique to each generator.)

Fixes: #28050
2026-10-14 16:10:45 -04:00
Brad King 37a2dfff14 Merge topic 'file-DIFFERENT-doc'
f030dcf26a Help: Document file(DIFFERENT)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12632
2026-10-14 10:35:28 -04:00
Brad King b341720cbf Merge topic 'file-DIFFERENT-doc' into release-4.5
f030dcf26a Help: Document file(DIFFERENT)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12632
2026-10-14 10:35:25 -04:00
Daksh Mamodiya f030dcf26a Help: Document file(DIFFERENT)
It has been around since CMake 2.6.3 for generated install scripts but
was never documented.  Added a test for the result too, since nothing
checked it before.

Fixes: #28154
2026-10-14 15:43:31 +02:00
Cristian Adam cec0ec5273 PCH: Add PCH_WARNINGS property to get warnings from precompiled headers
The generated precompiled header is marked as a system header, which
suppresses the diagnostics of every header it includes.  Enabling
precompiled headers therefore silently hides warnings that the same
build
would produce without them.

Move the pragma out of CMAKE_PCH_PROLOGUE into its own
CMAKE_PCH_SYSTEM_HEADER_PRAGMA variable so that it can be omitted
independently of the user-facing prologue and epilogue, and add a
PCH_WARNINGS target property, initialized by CMAKE_PCH_WARNINGS, to omit
it.  The diagnostics are then reported once, while compiling the
precompiled header itself.

Fixes: #21219
2026-10-14 07:32:04 +02:00
Tyler Yankee 67f253a8d2 Help: Factor out "may use generator expressions"
This had already been factored out to `GENEX_NOTE.rst`, but wasn't
applied very widely. Consolidate the language to consistently spell out
(a) the reference to `cmake-buildsystem(7)` and (b) the prose 'with the
syntax "$<...>"'.

To accompany the change, modify cmRST to override redefinitions of
substitutions within a single context instead of appending. Otherwise,
with the new note files, `cmake --help-*` prints repeated fragments
when it collates all scopes of a given field (e.g., all
`prop_*/COMPILE_OPTIONS.rst` from
`cmake --help-property COMPILE_OPTIONS`).
2026-10-13 11:46:56 -04:00
Taylor SasserandTyler Yankee 41bb5b5e96 install: Add BUILD_DEPENDS option for install_prep targets
Add a `BUILD_DEPENDS` option to multiple `install` command signatures
for projects to specify dependencies which CMake cannot infer.

Co-authored-by: Tyler Yankee <tyler.yankee@kitware.com>
Closes: #27643
2026-10-12 13:58:14 -04:00
Taylor SasserandTyler Yankee 0ea2d28b54 Ninja: Add install_prep targets for minimal builds
Add `install_prep/<component>` convenience targets to the Ninja
generators to build dependencies of install components, and
`install_prep/all` to build the dependencies of all install components.

This is similar in flavor to commit ba6b6fbc24 (Ninja: Add Build
Dependencies for Tests, 2026-04-07), but here for the install command.

Co-authored-by: Tyler Yankee <tyler.yankee@kitware.com>
Issue: #27643
2026-10-12 12:23:46 -04:00
Tyler YankeeandTaylor Sasser 2a67f00fc8 Help: Add target names description to cmake-buildsystem(7)
Co-authored-by: Taylor Sasser <taylor.sasser@kitware.com>
2026-10-12 12:23:44 -04:00
Brad King dc56e8d603 Help/command/source_group: Clarify when file set support was added
Follow-up commit 6043014d1d (source_group(): Add file set support,
2026-06-13) and commit faeeac60e8 (Add SOURCE_GROUP properties for file
set and source file, 2026-06-20).
2026-10-12 11:43:48 -04:00
Tyler Yankee d5309429d0 ctest: Interpret relative paths in BUILD_DEPENDS
Previously, add_test and discover_tests required absolute paths to
files in BUILD_DEPENDS arguments. Relax this to allow projects to
specify relative paths, which is more consistent with e.g.
add_custom_command(DEPENDS).
2026-10-09 13:56:22 -04:00
Vito Gamberini f69754ad63 SYCL: Initial language implementation
Add experimental support for SYCL under an experimental gate. The
IntelLLVM and Adaptivecpp compilers are recognized, as well as upstream
Clang with libsycl support.

Fixes: #27219, #27905
2026-10-07 11:43:31 -04:00
Brad King eee17b260c Merge topic 'doc-test-prep-discovery'
68d889a299 Help: Polish discover_tests with build dependencies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12597
2026-10-06 10:36:38 -04:00
Tyler Yankee 68d889a299 Help: Polish discover_tests with build dependencies
Add a release note and version information pertaining to commit
463517fddd (ctest: Support Test Dependencies for discover_test modules,
2026-08-18).
2026-10-05 11:59:45 -04:00
Vito Gamberini ac25d58e72 Experimental: Remove SBOM experimental gate
Fixes: #28117
2026-10-04 22:22:55 -04:00
Martin Duffy 463517fddd ctest: Support Test Dependencies for discover_test modules
- Update discover_tests to work with test_prep targets and ctest --out-of-date
- Extend behavior to gtest_discover_tests
- Don't treat non-built targets as always out of date
- Support imported targets in BUILD_DEPENDS

Issue: #28052, #28070
2026-09-30 09:26:58 -04:00
Brad King a399d4c1ea Merge topic 'install-TARGETS-RUNTIME_DEPENDENCY_TARGETS'
53019cd2e6 install(TARGETS): Add option to install runtime deps built as other targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12483
2026-09-23 13:22:51 -04:00
Brad King e587ecb673 Merge topic 'doc-asm-att'
301307e4b8 Help: Add short description for ASM-ATT

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12537
2026-09-23 09:44:57 -04:00
Stepanov Igor 53019cd2e6 install(TARGETS): Add option to install runtime deps built as other targets
Add a `RUNTIME_DEPENDENCY_TARGETS` option for `install(TARGETS)`
to automatically install the necessary runtime shared libraries.

Closes: #23505
2026-09-22 10:40:52 -04:00
Brad King ec85176fbe Merge topic 'if-RULE-operator'
d4dc18c01b if() command: add RULE operator

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12529
2026-09-22 10:16:47 -04:00
Tyler Yankee 301307e4b8 Help: Add short description for ASM-ATT 2026-09-22 10:15:18 -04:00
Brad King 2020c66db9 Merge topic 'ctest-fixture-repeat'
5cced02b9d CTest: Repeat test fixtures with the tests that require them
4fcf3dd296 CTest: Ignore a checkpoint entry for a test that is not pending
32b25b94d6 CTest: Track one run number for a repeating test

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11638
2026-09-22 10:01:43 -04:00
Marc Chevrier d4dc18c01b if() command: add RULE operator 2026-09-21 18:10:48 +02:00
Brad King c512ae97ce Merge topic 'custom-rule-support'
386d1d874c Add support of custom rules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12361
2026-09-21 11:40:22 -04:00
Marc Chevrier 386d1d874c Add support of custom rules
Fixes: #27383
2026-09-20 11:43:10 +02:00
Taylor Braun-JonesandTyler Yankee 5cced02b9d CTest: Repeat test fixtures with the tests that require them
When ctest repeats tests with its --repeat option, it repeats each test
on its own.  A fixture's setup and cleanup tests therefore run all of
their repetitions back to back, and the tests they bracket repeat inside
a single setup/cleanup pair:

  setup -> setup -> test -> test -> cleanup -> cleanup

Add a FIXTURE_REPEAT_MODE test property to select how a fixture behaves
when its tests are repeated:

* AROUND_ALL_REPEATS: the fixture runs once, around all repetitions of
  the tests requiring it.
* AROUND_EACH_REPEAT: the fixture and the tests requiring it repeat
  together, so every repetition gets a fresh setup and its own cleanup.
* EACH_TEST_SEPARATELY: every test repeats on its own, as before.

The property describes the fixture rather than the test carrying it, so
setting it on any one of a fixture's setup or cleanup tests is enough.

In AROUND_EACH_REPEAT mode the tests of a fixture form a repeat group that
ctest re-queues as a whole once every test in it has finished.  The --repeat
condition then applies to the group the way it applies to an individual
test: until-fail repeats while the whole group passes, until-pass repeats
while any of it does not, and after-timeout repeats while any of it times
out.  Fixtures that share a test repeat together, so a test requiring two of
them still runs once per repetition.

A group is recorded the way a repeating test is: only once it stops
repeating, and with the results of its last repetition.  A group that
until-pass makes pass therefore reports a pass rather than the failure that
made it repeat, a test that DEPENDS on one of the group's tests waits for
the last repetition rather than the first, and `ctest -F` resumes an
interrupted group by running it again from the beginning.

Fixtures that repeat together have to agree on the mode: a test cannot
repeat with one fixture but not with another it takes part in, and a fixture
whose setup and cleanup tests disagree has no coherent behavior.  Report an
error and run nothing in those cases rather than pick an order in which a
test repeats after a fixture it requires has been cleaned up.

Add policy CMP0224 to select AROUND_EACH_REPEAT as the default for fixtures
whose setup and cleanup tests choose no mode themselves.  Record the mode
the policy chose in the generated test file under its own
_CMAKE_DEFAULT_FIXTURE_REPEAT_MODE keyword, so that ctest reads a mode
rather than the policy settings behind it, and so that a mode requested on
one of a fixture's tests wins over the default recorded for its siblings.
Only NEW needs recording: with nothing recorded, ctest already uses the
behavior of CMake 4.4 and below.  Fixtures are common, and the choice of
mode matters only to those who run ctest --repeat, so warn about the unset
policy only when the CMAKE_POLICY_WARNING_CMP0224 variable asks for it.

discover_tests() and gtest_discover_tests() create their tests while ctest
runs or at build time, too late for the policy to reach them, so carry the
setting in effect at their call sites through to the tests they create.

Report the repetition a grouped test belongs to in the "(run N/M)" suffix
of its "Start" line, as ctest already does for a test repeating on its own.

Co-authored-by: Tyler Yankee <tyler.yankee@kitware.com>
Fixes: #21438
2026-09-18 08:29:28 -04:00
Brad King 670f62d10d Merge topic 'cmake_path-empty-prefix'
7192a2b798 cmake_path: An empty path is not a prefix of any path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12493
2026-09-18 08:16:12 -04:00
Brad King ab46a992e5 Merge topic 'ctest-dashboard-preset-env'
27f28db197 Help: Clarify CTEST_NO_TESTS_ACTION support and interaction
a235560e53 Help: Clarify interaction between CTest parallelism toggles
f745dd11ab ctest: Respect test envvars set by CTEST_PRESET
277236a99a cmCTestTestCommand: Factor out preset resolution
81b46d87ba cmCTest: Factor out environment variable handling
4e81913645 Tests: Fix unset(ENV{...}) typos

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12495
2026-09-18 07:59:56 -04:00
Mickaël Germain 7192a2b798 cmake_path: An empty path is not a prefix of any path
cmake_path(IS_PREFIX) and $<PATH:IS_PREFIX> treated an empty path as a
prefix of every path, including another empty path, following
std::filesystem::path.  A prefix that is empty because a variable was
set to an empty value, or because a generator expression argument
expanded to nothing, therefore satisfied a check meant to reject it.

Return false for an empty prefix, in cmCMakePath::IsPrefix so that every
caller shares one implementation and both the plain and NORMALIZE forms
are covered.  Normalizing an empty path leaves it empty, so no separate
handling of NORMALIZE is needed.  Unlike the component comparison, which
follows std::filesystem::path deliberately, IsPrefix has no counterpart
in the standard: it borrows path iteration but the predicate itself is
defined by CMake, so an empty prefix is a gap to fill rather than a
standard answer to override.

Add policy CMP0223 and restore the old result behind it at the two
released surfaces.  The other callers of IsPrefix, source_group() and
the Makefile generator's source classification, take the new behavior
ungated: source_group() rejects an empty TREE argument before reaching
it, and the generator passes the source and binary directories.

The if(PATH_IS_PREFIX) operator, new in this same release, follows the
policy too rather than simply taking the new behavior, so that it agrees
with cmake_path(IS_PREFIX) in every policy state and the parity
assertions in its test hold unconditionally.

Fixes: #28077
2026-09-17 10:05:27 -04:00