13899 Commits

Author SHA1 Message Date
Brad King
cd5a8dfa8e Merge topic 'genex-list-transform-apply'
0f6e8ded1d GenEx: add $<LIST:TRANSFORM,...,APPLY,body> action
c0a0b7fdd9 GenEx: add bound-operand binding mechanism and $<_0>
caa51f5689 GenEx: factor TRANSFORM selector parsing and selection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12203
2026-06-23 10:17:50 -04:00
Brad King
dfd1cf8d87 Merge topic 'import-std-refactor'
42d2d63235 c++modules: Copy props from BMI consumers more correctly
6d3e9d8220 c++modules: single import std target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !12193
2026-06-22 18:21:02 -04:00
Mickaël Germain
0f6e8ded1d GenEx: add $<LIST:TRANSFORM,...,APPLY,body> action
Add an APPLY action to $<LIST:TRANSFORM> that evaluates an arbitrary <body>
once per selected element, with $<_0> bound to the element, so a list can be
mapped through any generator expression at generate time.  Unlike the
configure-time list(TRANSFORM ... APPLY <function>) command, the genex form has
no side effects and returns the body's value directly, and a list-valued result
expands into multiple elements.

The body evaluates in its own binding scope, so nested APPLY actions can shadow
$<_0>, and context-sensitive state it observes (such as target dependencies)
still propagates to the enclosing expression.  APPLY accepts the same
AT/FOR/REGEX selectors as the canned actions.

Issue: #27892
2026-06-21 18:05:53 -07:00
Mickaël Germain
c0a0b7fdd9 GenEx: add bound-operand binding mechanism and $<_0>
Introduce "binding operations": generator expressions that evaluate a <body>
once for each value they supply, with $<_0> expanding to that value.  This is
the foundation the $<LIST:TRANSFORM,...,APPLY> action and the predicate
selectors build on, letting a <body> refer to the element being processed.

Using $<_0> outside a binding operation is reported as an error rather than
silently expanding to nothing.

Issue: #27892
2026-06-20 12:32:30 -07:00
Brad King
e6e3d728e9 Merge topic 'instrumentation-interrupt'
bda67b82e7 instrumentation: Write cmakeBuild snippet when build is interrupted
b801e7c78d instrumentation: Bump data version to 1.2

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !12154
2026-06-19 10:02:06 -04:00
Vito Gamberini
42d2d63235 c++modules: Copy props from BMI consumers more correctly
Fixes: #27891
2026-06-19 09:23:38 -04:00
Vito Gamberini
6d3e9d8220 c++modules: single import std target 2026-06-18 15:20:54 -04:00
Brad King
258f92379f Merge topic 'xcode-deterministic-product-file-reference-uuids'
2cc75c6072 Xcode: Use deterministic object ids for product file references

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12185
2026-06-18 11:20:18 -04:00
Brad King
9b4a48e48d Merge topic 'pvs-fixes'
e2f4b9bedc pvs-studio: (V522) Prevent possible null-pointer dereference in RemoveRPathELF
77b874baa8 pvs-studio: (V1086) Fix buffer writes
a77b7aa836 pvs-studio: (V557) Harden array boundary checks
7217af55da pvs-studio: (V555) Clarify size_type comparison

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12077
2026-06-18 11:16:07 -04:00
Brad King
0060cb72e8 Merge topic 'function-argnc'
82c9d33e96 function: Set variable ARGNC
d14d0b0b23 function: Change arguments documentation to a definition list

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12173
2026-06-18 11:14:48 -04:00
Brad King
edb85664e2 Merge topic 'file-archive-create-patterns-exclude'
9800bd2098 file(ARCHIVE_CREATE): Add PATTERNS_EXCLUDE option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12179
2026-06-18 11:13:03 -04:00
Brad King
fcc9b7779b Merge topic 'spdx_license'
b533f229b8 cmSbom: Generate SPDX data denoting project licenses

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12133
2026-06-18 11:11:29 -04:00
Daksh Mamodiya
bda67b82e7 instrumentation: Write cmakeBuild snippet when build is interrupted
The overall `cmakeBuild` snippet is written only after the native build
tool returns, so interrupting `cmake --build` with Ctrl+C terminated CMake
before it was recorded and lost the build's delineation.

When instrumentation is active, install a scoped, async-signal-safe handler
(POSIX SIGINT; Windows CTRL_C/CTRL_BREAK) that just flags the interrupt. The
existing write then runs during unwind, records the interrupting signal in a
new `interruptSignal` field, skips the post-build index hook, and re-raises so
the exit status still reflects the signal.

The handler lives in its own translation unit, keeping the platform-divergent
signal code out of the main instrumentation implementation.

Issue: #27859
2026-06-18 15:38:43 +02:00
Daksh Mamodiya
b801e7c78d instrumentation: Bump data version to 1.2
Raise the maximum supported data version and the version CMake writes in
its snippet files from 1.1 to 1.2.
2026-06-17 18:24:25 +02:00
Martin Duffy
77b874baa8 pvs-studio: (V1086) Fix buffer writes
Replace space-filling memset calls with bounded character initialization that
preserves null termination for the curses help text buffers.
2026-06-17 10:13:03 -04:00
lapfelix
2cc75c6072 Xcode: Use deterministic object ids for product file references
Follow-up commit 1fa2ec1bbd (Xcode: Use deterministic object ids for
targets, 2024-04-04, v3.30.0-rc1~263^2).  Each target's product
PBXFileReference (the libfoo.a / foo entries under the Products group)
was created with a random object id on every regeneration.  When a
CMake-generated Xcode project is embedded in another Xcode project, that
parent keeps the product reference's id in its remoteGlobalIDString; a
random id means the reference no longer resolves and the link falls back
to a bare `-l` flag (e.g. `ld: library 'foo' not found`).

Derive the product PBXFileReference id from the target name and the
build-tree-relative product path, the same hashing path already used for
the target object id.  The id is now stable across regenerations and
independent of the absolute build tree location.
2026-06-17 09:59:31 -04:00
Brad King
21769c177b Merge topic 'if-diagnostic'
597c573d7d if: Add `DIAGNOSTIC <category>` condition

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12181
2026-06-17 08:54:50 -04:00
Brad King
d20e909f3d Merge topic 'if-diagnostic' into release-4.4
597c573d7d if: Add `DIAGNOSTIC <category>` condition

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12181
2026-06-17 08:54:47 -04:00
Brad King
6b902b1cd9 Merge topic 'fix-cps-requires-crash'
01f8d249bf CPS: Fix crash when package `requires` isn't an object

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12182
2026-06-17 08:49:13 -04:00
Brad King
7450dc05ae Merge topic 'fix-cps-requires-crash' into release-4.4
01f8d249bf CPS: Fix crash when package `requires` isn't an object

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12182
2026-06-17 08:49:09 -04:00
Brad King
c154e36fac Merge topic 'ExternalProject-env-quoting'
036c331b97 ExternalProject: Fix ENVIRONMENT_MODIFICATION with spaces in values

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12178
2026-06-17 08:45:33 -04:00
Brad King
25eb4244db Merge topic 'ExternalProject-env-quoting' into release-4.4
036c331b97 ExternalProject: Fix ENVIRONMENT_MODIFICATION with spaces in values

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12178
2026-06-17 08:45:31 -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
Matthew Woehlke
01f8d249bf CPS: Fix crash when package requires isn't an object
Check whether a package `requires` is actually an object before trying
to iterate over it.
2026-06-16 15:03:05 -04:00
Brad King
906c000f0c Merge topic 'ctest_propagate_site_buildname'
433721b7a7 ctest: Pass CTEST_SITE/CTEST_BUILD_NAME to configure step

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12176
2026-06-16 10:26:48 -04:00
Brad King
35128a5186 Merge topic 'ctest_propagate_site_buildname' into release-4.4
433721b7a7 ctest: Pass CTEST_SITE/CTEST_BUILD_NAME to configure step

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12176
2026-06-16 10:26:46 -04:00
Brad King
e87b932007 Merge topic 'instrumentation-snippet-schema'
bf71991174 instrumentation: Add JSON schema for snippet files
b736acdc3b Tests/instrumentation: Check errors for query schema validation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12170
2026-06-16 10:24:32 -04:00
Brad King
a124a00544 Merge topic 'instrumentation-snippet-schema' into release-4.4
bf71991174 instrumentation: Add JSON schema for snippet files
b736acdc3b Tests/instrumentation: Check errors for query schema validation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12170
2026-06-16 10:24:30 -04:00
Brad King
6e71816f9e Merge topic 'extract-tar-resource-leak-path'
c31361d089 file(ARCHIVE_EXTRACT): Fix resource leaks on error paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12174
2026-06-16 10:21:52 -04:00
Brad King
b9a8b78822 Merge topic 'extract-tar-resource-leak-path' into release-4.4
c31361d089 file(ARCHIVE_EXTRACT): Fix resource leaks on error paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12174
2026-06-16 10:21:50 -04:00
Daksh Mamodiya
9800bd2098 file(ARCHIVE_CREATE): Add PATTERNS_EXCLUDE option
Exclude files and directories matching the given patterns while creating
an archive, using libarchive's matcher for parity with file(ARCHIVE_EXTRACT).

Fixes: #27877.
2026-06-16 15:33:06 +02:00
Brad King
036c331b97 ExternalProject: Fix ENVIRONMENT_MODIFICATION with spaces in values
Fix commit e301cbffcc (ExternalProject: Set environment variables,
2025-04-09, v4.2.0-rc1~480^2) to quote arguments for ``EVAL CODE``,
used since commit cbf2daeed0 (ExternalProject: Preserve empty string
arguments, 2020-05-15, v3.18.0-rc1~99^2~1).

Fixes: #27876
2026-06-15 14:46:24 -04:00
Daniel Tierney
b533f229b8 cmSbom: Generate SPDX data denoting project licenses 2026-06-15 14:40:26 -04:00
Arha Gatram
82c9d33e96 function: Set variable ARGNC 2026-06-15 10:54:48 -07:00
Daksh Mamodiya
c31361d089 file(ARCHIVE_EXTRACT): Fix resource leaks on error paths
extract_tar() allocates archive_read, archive_write_disk, and
archive_match handles, but several early-return error paths did not free
them. Most notably, a PATTERNS entry matching nothing leaked all three
handles on every call, which accumulates inside a long-running
configure.

Scope the three handles with std::unique_ptr custom deleters so every
return path releases them automatically.  std::unique_ptr does not
invoke the deleter for a null pointer, and the libarchive *_free
functions are themselves no-ops on null, so no explicit guarding is
required.  archive_read_free()/archive_write_free() implicitly close the
handle if needed, matching the previous behavior.

Fixes: #27872
2026-06-15 11:47:24 -04:00
Zack Galbreath
433721b7a7 ctest: Pass CTEST_SITE/CTEST_BUILD_NAME to configure step
When performing the configure step in dashboard client mode, propagate
`CTEST_SITE` and `CTEST_BUILD_NAME` as the `SITE` and `BUILDNAME`
respective cache variables.

This causes the values recorded in `DartConfiguration.tcl` to match those
specified by the user, allowing subsequent ctest calls to reuse them
automatically.
2026-06-15 10:56:11 -04:00
Tyler Yankee
bf71991174 instrumentation: Add JSON schema for snippet files
Issue: #27504
2026-06-15 10:35:53 -04:00
Brad King
63d2c144f2 Merge topic 'export-diagnostic-context'
a557231285 Exports: Capture context for diagnostics

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12166
2026-06-15 10:35:30 -04:00
Brad King
57cdfc193d Merge topic 'export-diagnostic-context' into release-4.4
a557231285 Exports: Capture context for diagnostics

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12166
2026-06-15 10:35:28 -04:00
Tyler Yankee
b736acdc3b Tests/instrumentation: Check errors for query schema validation 2026-06-15 10:35:27 -04:00
Brad King
ec22dd0de3 Merge topic 'ctest_configure_preset_binarydir'
3b6247a148 ctest: Honor preset binaryDir for initial configuration

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12167
2026-06-15 10:23:55 -04:00
Zack Galbreath
3b6247a148 ctest: Honor preset binaryDir for initial configuration
Prior to this commit, ctest would sometimes use the current working directory
as its binary directory rather than honoring `binaryDir` from a configure
preset. This would occur when using ctest in dashboard client mode to perform
an initial configuration with a preset.

  `ctest --source-dir=<dir> -T Configure -D CTEST_PRESET=<preset>`

An explicit `--build-dir` still takes precedence over the preset's `binaryDir`.
2026-06-13 08:50:33 -04:00
Brad King
debf2cc365 Merge topic 'file-archive-extract-extend'
531f3b568c file(ARCHIVE_EXTRACT): Add PATTERNS_EXCLUDE option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !12163
2026-06-12 09:28:58 -04:00
Matthew Woehlke
a557231285 Exports: Capture context for diagnostics
Modify install exports to make use of the install generator's captured
diagnostic context. Modify build exports to capture and use a diagnostic
context. This allows diagnostics issued by export file generation to use
the diagnostic context from the instigating command, and to provide a
backtrace to the same.
2026-06-11 17:06:12 -04:00
Brad King
363207b7d7 Merge topic 'cxx-modules-config-paths'
55f60d918d c++modules: Remove remaining restrictions on config-sensitive module paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12157
2026-06-11 11:44:06 -04:00
Vito Gamberini
55f60d918d c++modules: Remove remaining restrictions on config-sensitive module paths 2026-06-11 10:31:50 -04:00
Brad King
1bcedf7c51 Merge topic 'sbom-genex-configs'
32af67dc72 cmSbom: Add genex support for configurations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12140
2026-06-11 10:27:16 -04:00
Brad King
6f985e9c00 Merge topic 'instrumentation-ftime-trace'
576471ba47 Help/instrumentation: Add release notes for instrumentation data version 1.1
0480222ff4 instrumentation: Add compileTrace option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12048
2026-06-11 10:16:58 -04:00
Brad King
8d4479c2f9 Merge topic 'instrumentation-ftime-trace' into release-4.4
576471ba47 Help/instrumentation: Add release notes for instrumentation data version 1.1
0480222ff4 instrumentation: Add compileTrace option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12048
2026-06-11 10:16:57 -04:00
Daksh Mamodiya
531f3b568c file(ARCHIVE_EXTRACT): Add PATTERNS_EXCLUDE option
Omit archive entries matching the given patterns when extracting or
listing. May be combined with PATTERNS; on overlap the exclusion
takes precedence.

Fixes: #27837
2026-06-11 02:04:36 +02:00