Commit Graph
7761 Commits
Author SHA1 Message Date
Brad King 129c921fd0 Merge topic 'iar-fix-icstat-handler'
a17cbbee93 IAR: Add post-processing step in C-STAT outputs
4a8aeff8e4 IAR: Update ichecks error message
57fea01732 IAR: Fix malformed C-STAT command line

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12441
2026-08-28 09:31:26 -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
Brad King 47c0fd1977 Merge topic 'GNUInstallDirs-no-lang'
78b4ffa0a7 GNUInutallDirs: Suppress LIBDIR warning for LANGUAGES NONE projects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12440
2026-08-27 10:45:01 -04:00
Brad King 7d7a68ccd9 Merge topic 'presets_add_configurePresetName_macro'
02dd870535 presets: Add configurePresetName macro

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12391
2026-08-27 10:41:06 -04:00
Brad King ba0f16f6cb Merge topic 'ewilde/ninja-refactor-swift-builds'
23b33482f1 Swift: Refactor module / object builds

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12438
2026-08-27 10:36:55 -04:00
Martin Duffy 5f222e8f3a Instrumentation: Add Process Resource Usage Metrics
Issue: #26675, #27742
2026-08-27 10:24:25 -04:00
Felipe Torrezan a17cbbee93 IAR: Add post-processing step in C-STAT outputs
Harmonize IAR C-STAT headers between the first-time analysis
and subsequent builds, which uses cached results.

It also removes spurious relative paths such as `"../` and
`..\` that might appear after a new line followed by a double quote.
Effectively this will display paths relative to CMAKE_SOURCE_DIR,
similarly to the IDE, which display paths relative to $PROJ_DIR$.

Update the IAR tests to match the new C-STAT outputs.
2026-08-26 23:10:43 +02:00
rewine 78b4ffa0a7 GNUInutallDirs: Suppress LIBDIR warning for LANGUAGES NONE projects
Projects that explicitly use LANGUAGES NONE, e.g. to install only
data files, have no target architecture, which is intentional.
Default to `lib` without warning.

Fixes: #23461
2026-08-26 09:38:33 -04:00
Brad King 6ec33a4d0a Merge topic 'icstat-co-compile-source-file'
1470d96c44 IAR: Pass source file to C-STAT co-compile analysis

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12422
2026-08-26 09:21:14 -04:00
Maximilian Sander 02dd870535 presets: Add configurePresetName macro
Fixes: #28028
2026-08-25 14:33:10 -04:00
Brad King a584d8ed75 Merge topic 'system-env-id'
fc3c71d11f cmake: Add cached environment id that triggers reconfigure when changed

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12420
2026-08-25 11:47:48 -04:00
Brad King 5609e0d63b Merge topic 'more-deterministic-CTest-tests'
174ec6e410 Tests: Fix add_test and CrosscompilingEmulator tests in parallel

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12431
2026-08-25 10:44:27 -04:00
Aiden Woodruff fc3c71d11f cmake: Add cached environment id that triggers reconfigure when changed
The opaque `CMAKE_SYSTEM_ENVIRONMENT_ID` variable is cached during the
first invocation of `cmake` and is a user-defined hint about the state
of the environment. When the value changes, `cmake` either does nothing,
emits a warning (by default), or refreshes the cache as if by `--fresh`.
The action is controlled by the `CMAKE_SYSTEM_ENVIRONMENT_ACTION`
environment variable (which is not cached).

Implements: #28025
2026-08-24 15:06:35 -04:00
Aiden Woodruff 174ec6e410 Tests: Fix add_test and CrosscompilingEmulator tests in parallel
Some additional internal CTest tests require serial execution and break
when the CTEST_PARALLEL_LEVEL environment variable is used to specify
parallelism, which is required for parallelism bounded by processors via
test presets (see #27070).
2026-08-24 13:53:46 -04:00
Brad King 244b563b43 Merge topic 'autogen-vs-reduce-target-count'
d963b87ab4 Autogen: Reduce the number of targets under Visual Studio
2b5ad7e395 Autogen: Register per-config timestamp file with its full path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12409
2026-08-24 12:31:33 -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
Brad King 568b7bee83 Merge topic 'presets-list-defined'
2a9cde8b6e presets: Add defined listings with unavailable reasons

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12367
2026-08-24 12:22:13 -04:00
Brad King 3ed98a45a8 Merge topic 'makefiles-output-sync'
e135fd8e44 Makefiles: Group parallel build output via GNU Make --output-sync

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12399
2026-08-24 12:19:01 -04:00
Brad King 92c31a16c0 Merge topic 'link-library-needed-library-linux'
a2e6306c27 GenEx/LINK_LIBRARY: Add NEEDED_LIBRARY support on Linux
158b64688f Linker/GNU: Refactor LINKER_PUSHPOP_STATE_SUPPORTED check to a function
0f784069c3 Tests: Consolidate RunCMake.target_link_libraries-LINK_LIBRARY conditions
6491bd5a5f Help: Format LINK_LIBRARY NEEDED_LIBRARY platforms as a definition list

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12410
2026-08-24 12:14:51 -04:00
Brad King 7cc55e2db4 Merge topic 'ctest-repeat-number-of-runs'
135c7aa1f1 ctest: Add test rerun index "(run XX/YY)" to output

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Taylor Braun-Jones <taylor@braun-jones.org>
Merge-request: !12392
2026-08-24 12:06:15 -04:00
Maxime HaselbauerandTyler Yankee 135c7aa1f1 ctest: Add test rerun index "(run XX/YY)" to output
This makes the output more user friendly when using CTest's repeat
options (`until-fail`, `until-pass` `after-timeout`).

Closes: #28039
Co-authored-by: Tyler Yankee <tyler.yankee@kitware.com>
2026-08-21 09:11:52 -04:00
15daksh-2003 1470d96c44 IAR: Pass source file to C-STAT co-compile analysis
The <LANG>_ICSTAT co-compile appended --source= only when another
linter (tidy/cpplint/cppcheck/pvs) was also active, so a C-STAT-only
target ran `icstat analyze "" -- ...` with an empty file argument.
Add icstat to the --source= condition so C-STAT gets the real path.

Fixes: #28045
2026-08-21 00:55:59 +05:30
Brad King cb7a738f62 Tests: Fix RunCMake.CommandLine test on Solaris 10
Fix the shell script from commit 03e56cd338 (Tests: Add cases covering
`nm` handling for WINDOWS_EXPORT_ALL_SYMBOLS, 2026-07-27) to work on a
Solaris 10 host.
2026-08-19 18:14:58 -04:00
Maximilian Sander 2a9cde8b6e presets: Add defined listings with unavailable reasons
Add workflow and per-type defined values to cmake --list-presets.
Each -defined value lists every non-hidden preset of the selected type
and explains why unavailable presets cannot be used. The defined value
is an alias for configure-defined.

Support --list-presets=defined in cmake build and workflow modes,
ctest, and cpack. Propagate configure preset unavailability to
dependent build, test, package, and workflow presets.

Fixes: #28016, #26118
2026-08-19 16:47:50 +02:00
Evan Wilde 23b33482f1 Swift: Refactor module / object builds
Splitting up the computation of common variables, module build
variables, and object build variables to make it a little easier to
focus on each one.

Updated tests to reflect updated flag order and updated object-build
description.
2026-08-14 17:02:20 -07:00
Joerg Bornemann d963b87ab4 Autogen: Reduce the number of targets under Visual Studio
Commit 680fbb112a (Autogen: Enable depfile support for Visual Studio and
Xcode generators) disabled the PRE_BUILD optimization when a depfile is
used, because a PRE_BUILD event cannot carry depfile dependencies. Since
then, every target with AUTOMOC or AUTOUIC enabled gains an
'<ORIGIN>_autogen' and an '<ORIGIN>_autogen_timestamp_deps' target,
which the Visual Studio generators turn into two extra projects per
target in the generated solution.

Attach the autogen custom command to the origin target instead. The
custom command still carries the depfile, and the dependencies of the
origin target provide the ordering that
'<ORIGIN>_autogen_timestamp_deps' provides otherwise, because MSBuild
builds all referenced projects before any step of the referencing
project.

Use the conditions of the PRE_BUILD event, so that the
'<ORIGIN>_autogen' target keeps existing wherever it existed before
depfiles were enabled for the Visual Studio generators. In particular,
projects that name the target in add_dependencies() keep working.

Ninja and the Makefile generators keep the separate targets. Extra
targets have no cost for them, and '<ORIGIN>_autogen' has always existed
there.

The Xcode generator gained the same two targets per origin target in
4.4, but attaching the custom command there needs some more thoughts on
the per-config timestamp file first: Xcode rejects targets whose sources
vary by configuration, and with AUTOGEN_BETTER_GRAPH_MULTI_CONFIG the
timestamp file is per configuration.

Fixes: #28034
Fixes: #28033
2026-08-14 13:14:54 +02:00
Brad King f254d78638 Merge topic 'remove_message_prefix'
4eece9b32c cmake_language: Remove extraneous MESSAGE_PREFIX param

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12400
2026-08-14 06:34:14 -04:00
Brad King ca0ed0f66f Merge topic 'swift-cmp0215-update'
e4a37fbf15 Tests/RunCMake/Swift: Add CMP0195 behavior checks
b7a78568c3 CMP0215: Update NEW behavior to require CMP0157/CMP0195 to be NEW

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12407
2026-08-14 06:30:36 -04:00
Robert Maynard a2e6306c27 GenEx/LINK_LIBRARY: Add NEEDED_LIBRARY support on Linux 2026-08-13 13:45:19 -04:00
Robert Maynard 0f784069c3 Tests: Consolidate RunCMake.target_link_libraries-LINK_LIBRARY conditions 2026-08-13 13:45:19 -04:00
Tom Osika 8072e80f4b install(TARGETS): Add default destination for MODULE libraries
Installing a module target without a LIBRARY DESTINATION no longer
raises an error. On DLL platforms, the default destination is the
RUNTIME default. Otherwise, the LIBRARY default is used.

Closes: #27759
2026-08-13 10:55:07 -04:00
Evan Wilde e4a37fbf15 Tests/RunCMake/Swift: Add CMP0195 behavior checks
Adding checks to ensure that CMP0195 has the desired effect. If the
Swift compiler is too old and does not include the module triple in the
emitted target info, we won't set `CMAKE_Swift_MODULE_TRIPLE` and end up
with the flat directory structure. In this case, these tests won't have
the expected layout.

Issue: #28021
2026-08-13 10:18:16 -04:00
Evan Wilde b7a78568c3 CMP0215: Update NEW behavior to require CMP0157/CMP0195 to be NEW
Update CMP0215 to avoid attempting to iterate through the flags
looking for `-emit-module-path` ins the user-specified flags. We don't
do this anywhere else in the code. The existing implementation didn't
handle correctly parsing the flag so `-I blah/my-emit-module-path/` and
`-Xcc -emit-module-path ...` would both trigger it, result in the
compiler not emitting any module. Furthermore, it didn't include the
user-specified module path as part of the build graph resulting in an
incorrect build graph that would never resolve.

The only two appropriate layouts for the module are either the flat
binary module file with the name `<module-name>.swiftmodule`, or the
nested form with
`<module-name>.swiftmodule/<module-triple>.swiftmodule`. The noted
Swift-Syntax situation passes the explicit `-emit-module-path` to get to
the latter form. This form is automatically emitted by CMake when
CMP0195 is `NEW`, removing the need for the flag. The Swift project
generally recommends the nested directory structure since it gathers all
of the generated interface outputs from the compiler (textual swift
interfaces, swiftdoc, sourceinfo, and the binary swiftmodule file) in a
single place, and since it uses the module triple in the filename,
cleanly allows fat mach-o binaries on Apple platforms.

Fixes: #28021
2026-08-13 10:14:16 -04:00
15daksh-2003 e135fd8e44 Makefiles: Group parallel build output via GNU Make --output-sync
A parallel `cmake --build` with a Makefiles generator interleaved the
output of concurrent recipes.  When CMake is the one passing the
parallel flag and a build-time probe finds GNU Make 4.0 or newer,
append `-Otarget` so each recipe's output stays grouped.  A native
`-- -j` leaves the job count unset and opts out.

Honor `USES_TERMINAL` under grouping by prefixing such recipes with a
`$(CMAKE_USES_TERMINAL_PREFIX)` variable, empty by default and set to
`+` next to `-Otarget`, so interactive commands stay unbuffered.

Fixes: #27510
2026-08-13 10:00:13 -04:00
Tom Osika 4eece9b32c cmake_language: Remove extraneous MESSAGE_PREFIX param 2026-08-12 12:01:53 -04:00
Brad King 9f73c35d67 Merge topic 'list-transform-shared-state'
3151f7824f cmList: Fix shared state across nested list(TRANSFORM) calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12390
2026-08-12 11:42:42 -04:00
Brad King 478912138b Merge topic 'list-transform-shared-state' into release-4.4
3151f7824f cmList: Fix shared state across nested list(TRANSFORM) calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12390
2026-08-12 11:42:40 -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
Tom Osika 048ee670f2 cmake_print_properties: Deprecate in favor of cmake_language(PRINT_PROPERTIES)
Re-implement it in terms of the replacement command.

Issue: #27513
2026-08-10 17:45:47 -04:00
Tom Osika 2a2012e913 cmake_language: Add PRINT_PROPERTIES operation
Print CMake entities' properties in human-readable form for debugging.

Issue: #27513
2026-08-10 17:41:05 -04:00
Brad King bae815ccf7 Merge topic 'fix-check-modules-again'
3209535fb3 Check*: Restore toleration of false-like requirements

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12387
2026-08-10 09:52:25 -04:00
Fabrice de Gans d75d5dfadf ASM: Record all assembler id information
Previously, `CMAKE_ASM${DIALECT}_COMPILER_FRONTEND_VARIANT` and
`CMAKE_ASM${DIALECT}_SIMULATE_ID` were not saved in with the build
configuration. As a result, these were left unpopulated on re-configure.
This is particularly problematic when `clang-cl` is used as the
assembler on Windows, since CMake would mistakenly identify the build as
being "GCC on Windows", resulting in include paths being passed with
forward slashes on re-configure, causing a full rebuild.

Fix the issue by saving the information so it persists across
re-configures.
2026-08-08 10:51:14 -04:00
Brad King fd093f59e7 Merge topic 'string-json-array-split'
7cca8540ca string(JSON): Add ARRAY_SPLIT mode for linear array iteration

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12386
2026-08-08 10:49:20 -04:00
Brad King 3fdafa3302 Merge topic 'windows-toolchain-input'
f5837208f5 CMAKE_TOOLCHAIN_FILE: Fix Windows saved input toolchain file syntax error
996fc21020 Tests: Enable toolchain parts of RunCMake.CompilerChange on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12382
2026-08-08 10:47:50 -04:00
Brad King 628ceffe6b Merge topic 'enable-language-subdirectory'
86759dce81 enable_language: add support for usage in subdirectories
220fc8622d block: Fix incorrect policy scope creation order

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12222
2026-08-08 10:45:42 -04:00
Matthew Woehlke 3209535fb3 Check*: Restore toleration of false-like requirements
Commit 7644d557df (Check*: Refactor variable handling, 2026-07-20,
v4.4.1~12^2~1) introduced a subtle regression in the handling of
`CMAKE_REQUIRED_LINK_OPTIONS` and `CMAKE_REQUIRED_LIBRARIES` which
resulted in an error if these were set to a 'false-like' value. This
could happen, for example, if the user passes `<name>_LIBS`, which
happens to have the value `<name>-NOTFOUND`. Previously, such values
would be ignored.

Fix it by separately checking for user- or module-provided link options
or link libraries. (We were already doing this for the other variables
used to propagate requirements into checks.)

Fixes: #28026
2026-08-07 14:14:52 -04:00
Aiden Woodruff f5837208f5 CMAKE_TOOLCHAIN_FILE: Fix Windows saved input toolchain file syntax error
The value of _CMAKE_INPUT_TOOLCHAIN_FILE can contain backslashes when
Windows path separators are used. This commit ensures regression tests
check such cases and saves the value with a bracket argument to avoid
causing a syntax error due to the backslashes.

Fixes: #28024
2026-08-07 13:04:14 -04:00
Aiden Woodruff 996fc21020 Tests: Enable toolchain parts of RunCMake.CompilerChange on Windows
A regression was missed partially due to this suite's condition. The
compiler specific pieces still need this condition because a shell
script needs to pretend to be a compiler, but the toolchain parts are
platform agnostic.

Issue: #28024
2026-08-07 13:03:49 -04:00
Brad King ebd3af92f9 Merge topic 'print_variables'
4f09a029dc cmake_print_variables: Deprecate in favor of cmake_language(PRINT_VARIABLES)
a06658b6d7 cmake_language: Add PRINT_VARIABLES operation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12160
2026-08-07 11:48:00 -04:00
Daksh Mamodiya 7cca8540ca string(JSON): Add ARRAY_SPLIT mode for linear array iteration
Iterating a JSON array with GET re-parses the entire string on every
call, so walking N elements is O(N^2).  ARRAY_SPLIT parses the array
once and returns its elements as a CMake list, letting each element be
queried individually in linear total time.

Each element is re-serialized as compact JSON and encoded to survive
CMake list parsing: '[' and ']' inside strings are emitted as \u005B
and \u005D, and ';' is escaped as '\;'.  Every element therefore stays
valid, re-queryable JSON.

Fixes: #27985
2026-08-07 17:45:50 +02:00