2009 Commits
Author SHA1 Message Date
Tyler Yankee bc7346c06b Help/if: Fix indentation level of if(DEFINED) 2026-10-29 09:30:34 -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
Marc Chevrier ccc15ac21c Custom rule: ensure user's callbacks are executed during config step 2026-10-22 23:10:38 +02: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
Tyler Yankee dddf9c11a3 Help/add_custom_rule: Fix a few typos 2026-10-18 07:58:08 -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 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 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
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
Tyler Yankee 27f28db197 Help: Clarify CTEST_NO_TESTS_ACTION support and interaction 2026-09-16 09:51:11 -04:00
Tyler Yankee a235560e53 Help: Clarify interaction between CTest parallelism toggles 2026-09-16 09:51:10 -04:00
Matthew Woehlke 2673161b67 install: Improve documentation, argument parsing
Adjust documentation of `install(CODE|SCRIPT)` to more understandably
reflect how the subcommand actually operates. Adjust argument parsing of
the same to "accept" the `COMPONENT` argument being given more than
once, consistent with how single-valued arguments are usually parsed.
2026-09-11 12:22:25 -04:00
Brad King 34bbc91e3b Merge topic 'if-PATH_IS_PREFIX'
860583ceac if: Add PATH_IS_PREFIX operator
3d53f7901b Tests: Cover cmake_path(IS_PREFIX) path semantics
59a096f73b Tests: Detect a malformed genex in the PATH:IS_PREFIX test

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12427
2026-09-11 09:11:02 -04:00
Mickaël Germain 860583ceac if: Add PATH_IS_PREFIX operator
Testing whether one path is a prefix of another is possible today with
cmake_path(IS_PREFIX), but the idiom needs a separate statement plus a
scratch variable and takes the prefix as a variable name, so projects
reach for if(path MATCHES "^${prefix}") instead.  That is wrong whenever
the prefix contains a regex metacharacter, and it accepts siblings,
because '^/a/b' matches '/a/bc'.

Add a binary operator where the left operand is the candidate prefix and
the right is the path, matching the operand order of cmake_path(IS_PREFIX)
and $<PATH:IS_PREFIX> so that the same operation reads the same way on all
three surfaces.  Neither operand is normalized, matching the default of
cmake_path(IS_PREFIX) and the existing PATH_EQUAL operator, so '.' and
'..' are compared as ordinary components.  The test is non-strict, purely
lexical, and applies no relative-to-absolute reconciliation.

Add policy CMP0222 for compatibility, modeled on CMP0139.  The keyword
is consumed as an operator only when it appears in the second argument
slot, so a variable named PATH_IS_PREFIX keeps working in unary and
left-operand position.  What the policy covers is such a variable
appearing after another token, as in if(NOT PATH_IS_PREFIX AND other),
which becomes a configure error under NEW.

Since the operator is an if() spelling of cmake_path(IS_PREFIX) and shares
its implementation, test it by asserting the two agree over a corpus of
inputs rather than by restating expected values.  Those are pinned by the
cmake_path(IS_PREFIX) test, so the operator's tests stay limited to what
has no command equivalent, and no platform branching is needed because
parity holds whatever the host path model answers.

Fixes: #28040
2026-09-10 07:09:47 -04:00
Tyler Yankee 7350b58c16 Help: Move regex specification to cmake-language(7)
Many other places in CMake beyond the `string` command rely on our
regex syntax, so it should be documented in a more general location.

Fixes: #22270
2026-09-07 10:17:42 -04:00
Brad King 99079ccab6 Merge topic 'chsi-distrib-host-vs-target'
52c8b8104b cmake_host_system_information: select host vs sysroot for DISTRIB_*

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Merge-request: !12453
2026-09-03 09:04:03 -04:00
Daksh Mamodiya 52c8b8104b cmake_host_system_information: select host vs sysroot for DISTRIB_*
`DISTRIB_*` read os-release under `CMAKE_SYSROOT`, so cross builds got
the target distro from a host-oriented command, and a process-wide
static froze the first result.  Add a `FROM_SYSROOT <bool>` option and
policy `CMP0221` to default to the host, parse per call, and scope
`CMAKE_SYSROOT` so the fallback scripts follow the same choice.

Fixes: #27640
2026-09-02 14:48:36 +02:00
Alex Turbov 76a8381c98 ci(pre-commit): version bump typos hook + fix found typos 2026-08-29 05:26:37 +04:00
Brad King c23b537168 Merge topic 'instrumentation-proc-metrics'
5f222e8f3a Instrumentation: Add Process Resource Usage Metrics
7204679f48 Merge branch 'upstream-KWSys' into instrumentation-proc-metrics
431a794a66 KWSys 2026-08-27 (8f4afc3e)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12381
2026-08-28 09:17:39 -04:00
Martin Duffy 5f222e8f3a Instrumentation: Add Process Resource Usage Metrics
Issue: #26675, #27742
2026-08-27 10:24:25 -04:00
Brad King 1f40df769c Merge topic 'install-RUNTIME_DEPENDENCY_SET-note'
9057de7baf Help/install: Promote RUNTIME_DEPENDENCY_SET caveat to note

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12433
2026-08-25 09:34:09 -04:00
Brad King e903d46b9a Merge topic 'install-TARGETS-default-MODULE'
8072e80f4b install(TARGETS): Add default destination for MODULE libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12403
2026-08-24 12:27:07 -04:00
Tyler Yankee 9057de7baf Help/install: Promote RUNTIME_DEPENDENCY_SET caveat to note
Amends the documentation update in commit 24b76eaa93 (Help: Improve
readability and accuracy of runtime deps-related content, 2021-07-03,
v3.21.0-rc3~16^2).

Until a new feature is (potentially) implemented offering projects more
flexibility in this regard, the semantics around installation of
internal build-tree dependencies should be clarified, as it has caused
confusion on multiple occasions.

Issue: #28048
2026-08-24 11:26:39 -04:00