1908 Commits
Author SHA1 Message Date
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
Mickaël Germain 3151f7824f cmList: Fix shared state across nested list(TRANSFORM) calls
The TRANSFORM action registry held one live action instance per action for
the whole process, and each instance carried per-call state: a raw Selector
pointer, REPLACE's helper, APPEND/PREPEND's operands.  That was harmless
while every action ran to completion uninterrupted, but commit c7af6e94d8
(list(TRANSFORM): Add PREDICATE selector, 2026-04-08, v4.4.0-rc1) added a
selector that runs a user function once per element, interleaved with the
transform.  User code reentering list(TRANSFORM) with the same action now
rebinds the shared instance mid-flight.  That produces silently wrong
results, and a use-after-free once any element is transformed after the
reentering one.  It needs no unusual code to hit: a predicate calling
find_package(Python) reaches list(TRANSFORM ... REPLACE) inside FindPython's
own module.

Make action objects immutable and per-call.  Operands and the selector become
constructor arguments, Initialize is deleted, and the registry becomes a
constexpr table of metadata with a MakeTransformAction factory.  The
InSelection guard, duplicated in all eight actions, moves into the base class.

This also closes a second hole in the same machinery.  TransformActionApply
overrode only the vector form of Initialize, so transform(APPLY, "f",
selector) dispatched to the empty two-argument virtual in the base, left
Selector null, and dereferenced it.  With no virtual Initialize left to
inherit, an APPLY action without a cmMakefile is no longer constructible, so
the throwing stub that guarded the vector form is no longer needed.

Close a third, from commit 651f82642c (Add APPLY action for list(TRANSFORM),
2026-04-08, v4.4.0-rc1): the cmMakefile overload performs APPLY
unconditionally but validated only the arity of the action passed to it.
APPEND, PREPEND and APPLY all take one argument, so transform(APPEND, "x",
makefile) passed validation and then silently ran APPLY, calling "x" as a
function instead of appending it.  Reject any action but APPLY up front.
That path is unreachable from CMake code, since HandleTransformCommand only
selects the overload for APPLY, and Tests/CMakeLib has no cmMakefile to drive
it with, so it carries no test.

Document the predicate's evaluation order while here.  It runs once per
element, immediately before that element would be transformed.  The manual
did not state the timing, which matters precisely because a predicate that
reenters list(TRANSFORM) observes the outer call mid-flight.

Fixes: #28031
2026-08-11 11:36:08 -04:00
FeRD (Frank Dana) 8df169ebe1 Help: target_sources: Align descriptions with signatures
Recent changes to the `target_sources()` docs changed the `<items>`
placeholders to `<source>` or `<files>` (for `FILE_SET` commands),
but the documentation still used "items" frequently, and even
`<items>` once.

Change all mentions of "items" to use terms that match the
corresponding placeholders, for consistency.
2026-07-21 15:42:13 -04:00
Matthew Woehlke 597c573d7d if: Add DIAGNOSTIC <category> condition
Add an existence check to the `if` command for diagnostic categories,
mirroring the check for policies. Aside from being desirable for
consistency's sake, this will make it easier for users to write logic to
manipulate diagnostics from newer versions of CMake that don't exist
today.
2026-06-16 15:14:13 -04:00
Martin Duffy 0480222ff4 instrumentation: Add compileTrace option
Adds support for optionally saving and reporting trace files generated by
Clang's `-ftime-trace` option.
2026-06-10 15:19:41 -04:00
Brad King 059170f19c Merge topic 'instrumentation-stderr-stdout' into release-4.4
8e2aecbe42 instrumentation: Increase data version to 1.1
1a85245496 instrumentation: Optionally Record Command Output
6674be6d26 RunCMake: Allow error output suppression from run_cmake

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12031
2026-06-05 10:51:52 -04:00
Brad King 1081423099 Merge topic 'doc-message-log-level' into release-4.4
ef5e1e3a5b Help: Fix references to cmake_language(GET_MESSAGE_LOG_LEVEL)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12144
2026-06-05 09:25:00 -04:00
Brad King 880290c696 Help: Update Sphinx versionadded directives for 4.4 release
Run the script:

    Utilities/Sphinx/update_versions.py --since v4.3.0 --overwrite
2026-06-04 11:46:51 -04:00
Martin Duffy 8e2aecbe42 instrumentation: Increase data version to 1.1 2026-06-04 10:42:04 -04:00
Tyler Yankee ef5e1e3a5b Help: Fix references to cmake_language(GET_MESSAGE_LOG_LEVEL)
While we're at it, use the new `:cmake-option:` role to shorten some
references to `--log-level`.
2026-06-04 09:03:55 -04:00
Zack Galbreath a798a84b22 ctest: add new variable CTEST_SUBMIT_PARTS
This new variable allows dashboard client users to specify what parts
to submit.
2026-06-03 10:45:42 -04:00
Brad King 3b85f214d2 Merge topic 'instrumentation-data-version-minor'
f5a0f6478e Merge branch 'backport-instrumentation-data-version-minor' into instrumentation-data-version-minor
dcf146c34d instrumentation: Revise Data Version format
df36317176 instrumentation: Revise Data Version format

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12117
2026-06-03 09:51:48 -04:00
Brad King bdad2cbd97 Merge topic 'parse-arguments-argn'
97c36916d9 cmake_parse_arguments: Add PARSE_ARGN mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12131
2026-06-02 09:26:04 -04:00
Brad King 4bcb0a1dfa Merge topic 'fix-cmp0211-doc'
228795753f FILE_SET: Fix CMP0211-related documentation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12119
2026-06-02 09:19:40 -04:00
Brad King f4c858d328 Merge topic 'multi_export_sbom'
2900aa2911 SBOM: Update experimental UUID
273fc4cc49 SBOM: Support multi export set SBOMs
9669829573 Install: Refactor ResolveTargetsInGeneratorExpression
7c31cbf9ae SBOM: Handle PACKAGE_URL argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12080
2026-06-02 09:15:40 -04:00
Martin Duffy dcf146c34d instrumentation: Revise Data Version format
Give data version the new format <major>.<minor>, so that
the version can be incremented with the introduction of new
features without bumping the major version.

Add support for loading instrumentation JSON queries of unknown
data versions without error.

Issue: #27833
2026-06-02 08:55:20 -04:00
Arha Gatram 97c36916d9 cmake_parse_arguments: Add PARSE_ARGN mode
Introduce a mode similar to `PARSE_ARGV` that avoids needing
to specify the number of normal function arguments.

Closes: #25376
2026-06-01 18:06:25 -04:00
Tom Osika 273fc4cc49 SBOM: Support multi export set SBOMs 2026-06-01 12:27:13 -04:00
Zack Galbreath 7dc39e7221 ctest: prioritize presets over existing DartConfiguration.tcl commands
CMake writes ConfigureCommand and MakeCommand entries into
DartConfiguration.tcl when configuring a project that uses the CTest module.

These values prevented users from being able to use configure/build presets
in dashboard client mode from a pre-configured build directory.

This commit updates ctest_configure() and ctest_build() to ignore
CTEST_CONFIGURE_COMMAND / CTEST_BUILD_COMMAND when a preset is specified.
This allows the requested preset to be honored.
2026-05-29 11:40:47 -04:00
Matthew Woehlke 228795753f FILE_SET: Fix CMP0211-related documentation
Commit 4f120beea9 (FILE_SET: relax file uniqueness for HEADERS type,
2026-05-10) relaxed the restriction on file uniqueness in file sets, but
did not correctly update all instances of the documentation. Change the
wording to be a bit clearer and update all instances.
2026-05-28 16:53:01 -04:00
Brad King 0e6299c37f Merge topic 'ctest_preset_args_cli'
63b6e7d785 ctest: allow dashboard clients to specify presets via variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12109
2026-05-28 09:50:49 -04:00
Brad King ec2da34f39 Merge topic 'docs-empty-if'
2bc862bc76 Help: Document if() behavior with empty condition

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12108
2026-05-27 11:42:48 -04:00
Brad King df42ad80d3 Merge topic 'test-deps'
ba6b6fbc24 Ninja: Add Build Dependencies for Tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11935
2026-05-27 11:41:41 -04:00
Zack Galbreath 63b6e7d785 ctest: allow dashboard clients to specify presets via variables
Add variables to support specifying PRESET and PRESETS_FILE to
dashboard clients from the command-line.
2026-05-27 09:33:06 -04:00
Arha Gatram 2bc862bc76 Help: Document if() behavior with empty condition
Closes: #26527
2026-05-26 19:50:17 -04:00
Martin Duffy ba6b6fbc24 Ninja: Add Build Dependencies for Tests
Add `test_prep/<test_name>` convenience targets to the ninja generator
to build dependencies of tests, and `test_prep/all` to build the dependencies
of all tests.

Build dependencies of a test include:
- Executables directly invoked by test `COMMAND`.
- Targets mentioned in generator expressionf os test `COMMAND`.
- Anything explicitly listed with the new `BUILD_DEPENDS` argument of `add_test`.

Issue: #27613
2026-05-26 15:16:19 -04:00
Brad King 0d2e9ce13c Merge topic 'instrumentation-data-version-doc'
1d0f587062 instrumentation: Clarify API and Data version distinction

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12091
2026-05-21 09:45:18 -04:00
Martin Duffy 1d0f587062 instrumentation: Clarify API and Data version distinction
The instrumentation docs were unclear about the difference between API
and Data version, with the hierarchy of the table of contents being
particularly misleading.

Rework `cmake-instrumentation` manual and `cmake_instrumentation` command
documentation to be more clear.
2026-05-20 15:20:09 -04:00
Brad King 9d94a2abe6 Merge branch 'backport-cps-fix-default-dest' into cps-fix-default-dest 2026-05-19 15:26:46 -04:00
Matthew Woehlke ed6e9abf98 CPS, SBOM: Fix default output destination
- Change default CPS install path on Windows from `cps` to `cps/<name>`,
per community recommendation that only paths containing the package name
should be considered as "officially" supported search locations (see
https://github.com/cps-org/cps/issues/79#issuecomment-2831102822).

- Change `export` to write to a subdirectory that allows the build
tree to be used as a search root.

- Change SBOM destinations to be consistent with the preceding.

Issue: #27785
2026-05-19 13:31:56 -04:00
Brad KingandSerguei E. Leontiev 090e754a34 PellesC: Document support for this compiler
This was left out of commit b7a5f2732d (PellesC: Add minimal support for
this C compiler, 2026-04-03) because the implementation was not usable
in general.  It is now.

Closes: #21536
Co-authored-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-05-15 12:06:46 -04:00
Brad King 08bf1b6985 Merge topic 'ctest_commands_presets_file'
08dc82ceb3 ctest: add PRESETS_FILE option to CTest commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12042
2026-05-14 08:53:25 -04:00
Brad King 011fc8be63 Merge topic 'feature/list-functor-no-macro'
96c9a9c67d list: Reject macros as APPLY/PREDICATE/COMPARATOR arguments
08288eb14a list: Extract RequireFunction helper for command validation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11997
2026-05-14 08:45:19 -04:00
Zack Galbreath 08dc82ceb3 ctest: add PRESETS_FILE option to CTest commands
Allow CTest script authors to use presets from arbitrary files.
2026-05-12 15:49:39 -04:00
Mickaël Germain 96c9a9c67d list: Reject macros as APPLY/PREDICATE/COMPARATOR arguments
Fixes: #27781
2026-05-12 12:30:43 -07:00
Daniel Pfeifer 585e0d5878 ctest_update: Add options VERSION_ONLY and VERSION_OVERRIDE 2026-05-12 13:45:00 +02:00
Brad King 3b24c78ed9 Merge topic 'ctest_test_preset_option'
ef0d2ca6bb ctest: add PRESET option for ctest_test() and ctest_memcheck()
f9c831dad9 ctest: encapsulate loading of options from test preset

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12017
2026-05-11 11:12:42 -04:00
Brad King 61680b3b44 Merge topic 'cmake-diagnostics-variables'
72e7305c3e Diagnostics: Handle CMAKE_{WARN,ERROR}_DEPRECATED
be057c5a01 cmVariableWatch: Use enum for access type
cba542f32c cmake.cxx: Organize includes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11948
2026-05-08 07:44:05 -04:00
Zack Galbreath ef0d2ca6bb ctest: add PRESET option for ctest_test() and ctest_memcheck()
Allow users to specify a test preset when using CTest dashboard scripts.

Fixes #27630
2026-05-07 22:08:41 -04:00
Matthew Woehlke 72e7305c3e Diagnostics: Handle CMAKE_{WARN,ERROR}_DEPRECATED
Update documentation for aforementioned variables, as their use is
deprecated under the new diagnostic system. Introduce a policy which
reintroduces their use to control specific deprecation diagnostics if
the policy is not NEW.

Note that this means there is NO synchronization between the variables
and the new diagnostic state.
2026-05-07 11:07:27 -04:00
Mickaël Germain 3dc32ac62b list(SORT): Add COMPARATOR option for user-defined comparisons
Allow users to provide a custom comparison function for `list(SORT)`.
The comparator is validated for strict weak ordering at runtime to
produce a clear CMake error rather than a platform-dependent abort.

Closes: #27761
2026-05-06 15:09:06 -04:00
Brad King ffe0edc092 Merge topic 'list-predicate'
15340d6a96 list(FILTER): Add PREDICATE mode
c7af6e94d8 list(TRANSFORM): Add PREDICATE selector
0f30e0fe1c Help: Fix indentation of list(FILTER) docs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11945
2026-05-05 10:58:32 -04:00
Brad King 1c4ef7291f Merge topic 'cmake-diagnostics-doc'
95f7f84609 Help: Fix CMD_INSTALL_ABSOLUTE_DESTINATION documentation
a882ec84ec cmDocumentation: Add diagnostics
97d13c3053 Help: Improve diagnostics documentation
3cccce8ca2 Help: Add developer documentation for new diagnostics
ffe4c2a8ff Help: Fix developer documentation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !11996
2026-05-04 10:32:28 -04:00
Mickaël Germain 15340d6a96 list(FILTER): Add PREDICATE mode 2026-05-01 18:55:07 -07:00
Mickaël Germain c7af6e94d8 list(TRANSFORM): Add PREDICATE selector
Add a new `PREDICATE` selector to `list(TRANSFORM)` that uses a
user-defined function or macro to decide which elements to transform.

The predicate callable receives each element value and an output
variable name.  It must set the output variable to a truthy or falsy
value in PARENT_SCOPE; only elements for which the predicate returns
true are passed to the transform action.

Adds a shared PredicateEvaluator helper class used by both TRANSFORM
PREDICATE and (in a subsequent commit) FILTER PREDICATE.

Includes parser wiring, error and success tests covering all existing
actions (TOUPPER, TOLOWER, REPLACE, STRIP, GENEX_STRIP, APPEND,
PREPEND, APPLY) combined with the PREDICATE selector.

Issue: #27761
2026-05-01 18:54:53 -07:00
Brad King 0f30e0fe1c Help: Fix indentation of list(FILTER) docs 2026-05-01 09:47:12 -04:00
Matthew Woehlke 97d13c3053 Help: Improve diagnostics documentation
Make diagnostics into Sphinx objects so that they can be more readily
cross-referenced. (This is also needed to enable --help-diagnostic.)
Update various places that can make use of the same. Significantly
expand the documentation on controlling diagnostics.
2026-04-30 15:36:23 -04:00
Joseph Snyder a7780d1b9c ctest: Add a CoverageTool setting to enable integration with llvm-cov
Add a `CTEST_TEST_COVERAGE_TOOL` variable to tell CTest to integrate
with `llvm-cov` source-based code coverage by setting the
`LLVM_PROFILE_FILE` environment variable for each test.

Issue: #26932
2026-04-30 14:22:26 -04:00
Brad King a979d8eb3d Merge topic 'error_on_absolute_install_paths'
39a56136a3 Diagnostic: Add warn or error on absolute install paths
fd76089631 cmInstallFileSetGenerator: Only support per config Destination.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11882
2026-04-30 09:17:13 -04:00