Commit Graph
14303 Commits
Author SHA1 Message Date
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 f9ae489598 Merge topic 'cdash-instrumentation-proc-metrics'
01fa1984e5 instrumentation: Send processMetrics data to CDash
68e2a3e793 instrumentation: Rename userTime and systemTime fields to exclude units

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Tyler Yankee <tyler.yankee@kitware.com>
Merge-request: !12514
2026-09-18 08:11:50 -04:00
Brad King 50b4f2f8bb Merge topic 'instrumentation-test-fix-spam'
ff48c8d4d2 Tests/Instrumentation: Fix exponential output spam from validate_json_schema

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12515
2026-09-18 08:10:10 -04:00
Brad King fb4bab8ee5 Merge topic 'ninja-codegen-deps-fix'
2d85779126 Ninja: Account for explicit target dependencies via CODEGEN

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12512
2026-09-18 08:07:25 -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
Martin Duffy 01fa1984e5 instrumentation: Send processMetrics data to CDash 2026-09-17 10:29:06 -04:00
Martin Duffy 68e2a3e793 instrumentation: Rename userTime and systemTime fields to exclude units
Drop the "USec" suffix from these fields for consistency with other
instrumentation fields which do not include units.
2026-09-17 10:10:31 -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
Brad King a30ad325f4 Merge topic 'instrumentation-cdash-file-check'
77443e7258 instrumentation: Don't expect staged CDash files when cdashSubmit is disabled

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Tested-by: Aiden Woodruff <aiden.woodruff@kitware.com>
Merge-request: !12508
2026-09-16 14:39:28 -04:00
Brad King 61a28e735b Merge topic 'clang-cuda-offload-warn-unsupported'
616f65b379 Clang/CUDA: Warn when using offloading driver with RDC + PTX

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12500
2026-09-16 13:44:17 -04:00
Martin Duffy ff48c8d4d2 Tests/Instrumentation: Fix exponential output spam from validate_json_schema
Schema validations in Tests/Instrumentation called add_error("${RunCMake_TEST_FAILED}")
in a loop. Because add_error itself appends the input to RunCMake_TEST_FAILED, this
resulted in exponential growth of error messages on each loop iteration, filling the
test log with duplicate errors.

Isolate error messages from validate_json_schema to avoid exponential duplication.
2026-09-16 13:12:03 -04:00
Tyler Yankee f745dd11ab ctest: Respect test envvars set by CTEST_PRESET
Note the special attention given to support CTest environment variables
from inside a test preset's `environment` field.

Fixes: #28079
2026-09-16 09:34:43 -04:00
Tyler Yankee 4e81913645 Tests: Fix unset(ENV{...}) typos 2026-09-16 08:51:36 -04:00
Brad King 7e798bb389 Merge topic 'cmake-gui-preset-apply-ordering'
fdc2c2b9c7 cmake-gui: settle preset application before Configure/Generate

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12502
2026-09-15 11:29:28 -04:00
Robert Maynard 616f65b379 Clang/CUDA: Warn when using offloading driver with RDC + PTX
Fixes: #28084
2026-09-15 11:01:04 -04:00
Tyler Yankee 2d85779126 Ninja: Account for explicit target dependencies via CODEGEN
When a "normal" target (e.g., an executable) depends on a custom target
that is not part of `all`, and that custom target owns the output of a
custom command marked `CODEGEN`, an explicit `add_dependencies` from
the normal to custom target must be incorporated in `codegen`.

Amends commit 197cb419d1 (add_custom_command: Add CODEGEN support,
2024-05-27, v3.31.0-rc1~394^2), which already incorporated such logic
in the Unix Makefile generator, but was not tested nor implemented for
Ninja.

Fixes: #28092
2026-09-15 10:34:09 -04:00
Brad King a07b6e2a4d Merge topic 'improve-install-code-script'
2673161b67 install: Improve documentation, argument parsing

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12501
2026-09-15 09:58:50 -04:00
Brad King b0499f43d0 Merge topic 'Sources-various-enhancements'
bc4e849e50 cmValue: introduce constants cmValue::True and cmValue::False
a570ee4c8f cmPlaceHolderExpander: Add recognition of genex
b53f05cd8c cmArgumentParser: enhance multi command management
a53691b73a cmCustomCommand: reduce raw pointer usage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12506
2026-09-15 09:55:15 -04:00
Brad King c012ec02cc Merge topic 'test-cuda'
6131353bff Tests/Cuda: Skip unsupported case using Clang offloading driver with RDC + PTX
91f4a420cd Tests/Cuda: Remove redundant condition

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !12505
2026-09-15 09:38:23 -04:00
Craig Scott 15e476809c Merge topic 'fetchcontent-custom-command-verbosity-change'
d410092ece FetchContent: Move log level detection into step script

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Claus Klein <claus.klein@arcormail.de>
Merge-request: !12504
2026-09-14 17:42:28 -04:00
Martin Duffy 77443e7258 instrumentation: Don't expect staged CDash files when cdashSubmit is disabled 2026-09-14 15:38:40 -04:00
Marc Chevrier b53f05cd8c cmArgumentParser: enhance multi command management 2026-09-14 18:24:48 +02:00
Robert Maynard 6131353bff Tests/Cuda: Skip unsupported case using Clang offloading driver with RDC + PTX
Issue: #28084
2026-09-14 11:18:21 -04:00
Robert Maynard 91f4a420cd Tests/Cuda: Remove redundant condition
`CMake_TEST_CUDA` must be set to enter this directory.
2026-09-14 11:17:35 -04:00
Brad King f5efe7a6b5 Merge topic 'xcode-embed-genex'
90c03329dd Xcode: Honor generator expressions in XCODE_EMBED_<type>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12499
2026-09-14 10:58:37 -04:00
Brad King 1c54e46a17 Merge topic 'invalid-did-you-mean'
dd44b41cbe cmake -E: Add CLI argument spell checking
7dacfea25d cmake -E: Refactor help string to struct
1cd84285e7 cpack: Add CLI argument spell checking
314c720eaf cpack: Fail-fast on unknown arguments
ec138e6f8e ctest: Add CLI argument spell checking
1a68ffd75f cmMakefile: Add CML command spell checking
27dedeaafd cmake: Add CLI argument spell checking
fca1ecb8a3 cmStringAlgorithms: Add Levenshtein distance

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12456
2026-09-14 10:56:11 -04:00
Craig Scott d410092ece FetchContent: Move log level detection into step script
A step with a custom command shouldn't be seen as out-of-date
just because the user re-runs configure with a different log level.
Previously, the log level was written directly to the step scripts,
but that meant the script changes if the user specifies a different
effective log level to the previous configure. Now we move the
log level detection into the script so that the script remains the
same no matter what log level the user asks for.

This was most noticeable with the PATCH step, since that always
uses a custom command when present. Changing the log level
would cause the PATCH step to re-run, which usually results in
an error because PATCH typically only expects to run once after
a DOWNLOAD. But the underlying problem would affect any step
with a custom command, not just PATCH.

Fixes: #28055
2026-09-13 21:23:27 +10:00
Daksh Mamodiya fdc2c2b9c7 cmake-gui: settle preset application before Configure/Generate
Selecting a configure preset applies on the worker thread, but Configure
and Generate stayed enabled and could snapshot the stale cache model
first. Tokenize preset application, disable the dependent actions until
the completion lands, and accept only the latest request.

Fixes: #28085
2026-09-11 23:24:10 +05:30
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
Tor Arne Vestbø 90c03329dd Xcode: Honor generator expressions in XCODE_EMBED_<type>
Evaluate the XCODE_EMBED_<type> target property through the generator
expression evaluator before building the copy-files phase.  Xcode shares
one copy-files build phase across all configurations, so the embedded set
cannot vary by configuration.  Reject any expression whose result depends
on the configuration, matching the existing per-source diagnostic.

Fixes #28082
2026-09-11 16:45:25 +02:00
Brad King 216cc54531 Merge topic 'AUTOMOC-cxxmodules-support'
6280cc3df9 Autogen: Add AUTOMOC support for C++ module units
266c6f0109 Autogen: Factor out the info-file source-entry reader

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Reviewed-by: Vito Gamberini <vito.gamberini@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !12490
2026-09-11 09:16:10 -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
Brad King ddf5ae6a19 Merge topic 'install-code-refactor'
8997bb6431 install: Parse SCRIPT and CODE arguments with cmArgumentParser

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12492
2026-09-11 08:41:07 -04:00
Tyler Yankee dd44b41cbe cmake -E: Add CLI argument spell checking
Use Levenshtein distance to track when the user may have made a typo in
an argument to `cmake -E` (i.e., an invalid mode; mode sub-arguments
are not tracked).
2026-09-11 08:23:37 -04:00
Tyler Yankee 1cd84285e7 cpack: Add CLI argument spell checking
Use Levenshtein distance to track when the user may have made a typo in
an argument to `cpack`.
2026-09-11 08:23:35 -04:00
Tyler Yankee ec138e6f8e ctest: Add CLI argument spell checking
Use Levenshtein distance to track when the user may have made a typo in
an argument to `ctest`.
2026-09-11 08:23:32 -04:00
Tyler Yankee 1a68ffd75f cmMakefile: Add CML command spell checking
Use Levenshtein distance to track when the user may have made a typo in
a CMake language command.
2026-09-11 08:23:31 -04:00
Tyler Yankee 27dedeaafd cmake: Add CLI argument spell checking
Use Levenshtein distance to track when the user may have made a typo in
an argument to `cmake`, `cmake --build`, `cmake --install`, or
`cmake --workflow`.
2026-09-11 08:23:30 -04:00
Tyler Yankee fca1ecb8a3 cmStringAlgorithms: Add Levenshtein distance 2026-09-11 08:23:29 -04:00
Joerg Bornemann 6280cc3df9 Autogen: Add AUTOMOC support for C++ module units
Process C++ module interface and partition units that are members of a
FILE_SET of type CXX_MODULES.  moc is run on such units and its
generated output is compiled as a module implementation unit of the same
module, as its own scanned translation unit rather than folded into
mocs_compilation.cpp.  Macro-less units get an empty placeholder; module
units and their dependencies are tracked in the autogen depfile and as
byproducts for correct incremental rebuilds.

This requires Qt 6.13, whose moc supports C++ module units.  With older
Qt nothing can be generated for a module unit, so a meta-object macro
found in one is reported as an error rather than left to fail later in
the compiler or the linker.  Such a unit is no longer handled as an
ordinary source, which also means its moc include directives are not
honored and AUTOUIC does not process it.

moc rejects a meta-object macro in a module implementation unit or a
private module fragment, and AUTOMOC does not work around that.
2026-09-10 13:13:11 +02: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
Mickaël Germain 3d53f7901b Tests: Cover cmake_path(IS_PREFIX) path semantics
The IS_PREFIX test asserted four cases: duplicate separators collapsing,
a non-normalized '..' in the prefix, and two NORMALIZE cases.  None of
the rules a caller is most likely to get wrong were covered.

Add assertions for the non-strict self-prefix, trailing separators on
either operand, '.' components, the sibling-prefix trap, the absence of
relative-to-absolute reconciliation including the root directory, and
the empty path.  Add a host-path-model block covering backslashes, case
sensitivity of both ordinary components and the root-name, drive-
relative paths, and UNC root-names.
2026-09-10 07:09:39 -04:00
Brad King 20c30149e0 Merge topic 'fix-ctest-max-width'
865d6bf223 CTest: Support `--max-width` shorter than longest test name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12489
2026-09-09 13:27:11 -04:00
Brad King 4b2cf13e42 Merge topic 'findpkgconfig-l-colon'
0cc8f00e6b FindPkgConfig: support GNU ld -l:<file> exact-file syntax

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12485
2026-09-09 13:25:27 -04:00
Brad King 2d27955337 Merge topic 'help-command-anon-hyperlink'
119b2e62f8 cmRST: match anonymous hyperlink syntax
9ed206876f testRST: add test cases for anonymous hyperlinks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12482
2026-09-08 10:00:41 -04:00
Mickaël Germain 59a096f73b Tests: Detect a malformed genex in the PATH:IS_PREFIX test
The final assertion opened a generator expression and never closed it.
file(GENERATE) passes such a string through verbatim rather than
diagnosing it, and the result is a non-empty string, so an assertion
that tests only for truth cannot fail.  That case has been vacuous
since it was added.

Close the expression, and compare each result against the exact value
the operation returns rather than against its truthiness, so that a
malformed expression is reported instead of quietly satisfying the
check.
2026-09-07 20:29:29 -07:00
Nerixyz 865d6bf223 CTest: Support --max-width shorter than longest test name
Fixes: #24101
2026-09-07 18:21:35 +02:00
15daksh-2003 0cc8f00e6b FindPkgConfig: support GNU ld -l:<file> exact-file syntax
Some .pc files (e.g. DPDK) use -l:libfoo.a for an exact library file, but
we passed the colon to find_library and it never resolved. Strip it for
lookup, keep the token so an unresolved lib still falls back to -l:.

Fixes: #27452
2026-09-07 21:28:11 +05:30
Brad King e15ea144fb Merge topic 'presets-fix-name-string'
af277fe06f presets: Avoid string conversion on bad "name" type

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12487
2026-09-07 09:21:22 -04:00
Brad King fdadf6a520 Merge topic 'new-fuzzer-2'
3b58f95f8c OSS-Fuzz: Add new fuzzer targets Fortran Parser

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12481
2026-09-07 09:05:54 -04:00