Commit Graph
4406 Commits
Author SHA1 Message Date
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 0999f879aa Merge branch 'release-4.4' 2026-08-25 11:42:47 -04:00
Brad King af7ecc8c29 CMake 4.4.3 2026-08-25 11:10:30 -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
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
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
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
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 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 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 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
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
Arha Gatram 86759dce81 enable_language: add support for usage in subdirectories
Propagates variables set in enable_language() logic up variable scopes
so that the language can be used by targets in the ancestor directories.
Works through block() and function() scopes as well. The
add_subdirectory() call can be thought of as the effective call site for
enabling the language. The same holds for endblock() and the actual
function call.

Adds a policy CMP0220 to control this behavior. As the language is
"enabled" at each ancestor scope, the policy is checked. If OLD, the
language is not enabled at this scope and the ones above.

Closes: #27881 #27508 #27389
Related: #26751 #27564
2026-08-07 11:05:57 -04:00
Tom Osika 4f09a029dc cmake_print_variables: Deprecate in favor of cmake_language(PRINT_VARIABLES)
Re-implement it in terms of the replacement command.

Issue: #27513
2026-08-07 10:57:01 -04:00
Marc Chevrier 8c0bb8ee95 FindPython: Add support for python specific crosscompiling emulator
Fixes: #27996
2026-08-06 17:57:26 +02:00
Tom Osika a06658b6d7 cmake_language: Add PRINT_VARIABLES operation
Print CMake variables in human-readable form for debugging.

Issue: #27513
2026-08-05 14:45:44 -04:00
Brad King fc5ff503cf Merge topic 'ctest-json-test-prop-raw'
572e4b5d2a ctest: Add --show-only=json-v1-raw option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12288
2026-08-04 10:53:33 -04:00
Arha Gatram 572e4b5d2a ctest: Add --show-only=json-v1-raw option
This option changes the JSON value field for test properties to use the
unparsed string value.

Fixes: #27958
2026-08-03 09:36:11 -07:00
Brad King e98e59cc82 Merge topic 'FindPython-SOSABI_PLATFORM'
91e227939c FindPython: Add Python_SOSABI_PLATFORM variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12360
2026-08-01 07:27:55 -04:00
Marc Chevrier 91e227939c FindPython: Add Python_SOSABI_PLATFORM variable
This variable gives the SABI module extension which include the
platform triplet.

Fixes: #27997
2026-07-31 16:41:01 +02:00
Brad King 8e7b683c67 Merge branch 'release-4.4' 2026-07-31 09:30:03 -04:00
Brad King c162d6852d CMake 4.4.2 2026-07-31 09:01:06 -04:00
Brad King 8a947d73d5 Merge topic 'warn-non-target-directives'
00959286b9 Diagnostics: Warn about non-target directives

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12172
2026-07-29 10:34:27 -04:00
Matthew Woehlke 00959286b9 Diagnostics: Warn about non-target directives
Introduce `CMD_STRICT` to act as a parent for warnings about allowed but
disrecommended usage. Introduce a warning that discourages use of
non-target directives (which modify the build environment for the entire
[sub]tree). Add notes to the official documentation recommending use of
target-specific alternatives. This has been accepted wisdom for quite
some time, but only some of the affected commands made any mention of
this in the documentation.
2026-07-28 11:38:20 -04:00
Brad King b5efecc945 Merge branch 'release-4.4' 2026-07-28 10:59:30 -04:00
Brad King d1cffecacd CMake 4.4.1 2026-07-28 10:26:50 -04:00
Brad King 4b88240b64 Merge topic 'ctest_test-label-and'
257865e1d4 CTest: Make ctest_test() label filters multi-value (AND)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12321
2026-07-28 09:50:30 -04:00
Brad King 70f568b17b Merge topic 'FindPython-add-pydebug-ABI-support-on-Windows'
84cb7e2629 FindPython: Add support for pydebug ABI flag on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12325
2026-07-28 09:35:25 -04:00
Brad King 07368fab0c Merge topic 'test-include-files-genex'
63316be823 TEST_INCLUDE_FILES: Evaluate generator expressions in include paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12313
2026-07-27 10:12:30 -04:00
Marc Chevrier 84cb7e2629 FindPython: Add support for pydebug ABI flag on Windows
Fixes: #27969
2026-07-26 17:10:25 +02:00
Daksh Mamodiya 257865e1d4 CTest: Make ctest_test() label filters multi-value (AND)
The ctest(1) command line allows repeating -L/-LE to form an AND
filter over test labels, but the ctest_test() and ctest_memcheck()
scripting commands accepted only a single INCLUDE_LABEL/EXCLUDE_LABEL
value, so a dashboard script could not express that filter.

The label-matching engine already stores the include/exclude
expressions as vectors and applies them with AND semantics; only the
command binding was single-value.  Change both keywords to multi-value
(NonEmpty<vector<string>>) and hand the collected list straight to the
engine.  ctest_memcheck() gains the same behavior for free, since it
inherits the option set.

Fixes : #27497
2026-07-24 21:27:58 +02:00
Daksh Mamodiya 63316be823 TEST_INCLUDE_FILES: Evaluate generator expressions in include paths
The TEST_INCLUDE_FILE(S) directory properties were written verbatim into
CTestTestfile.cmake, so a $<CONFIG>-parameterized include path could not
select a per-configuration script and failed at ctest time.

Evaluate generator expressions per include entry in
cmLocalGenerator::GenerateTestFiles():

* Entries without a generator expression are emitted unchanged.
* On single-config generators a genex entry is evaluated once and
  emitted as one unconditional include.
* On multi-config generators it is evaluated for every configuration;
  a config-independent result collapses to one unconditional include,
  otherwise each non-empty per-config result is guarded by a
  CTEST_CONFIGURATION_TYPE branch, mirroring add_test().  An entry that
  evaluates to empty adds no include.

Promote cmScriptGenerator::CreateConfigTest to a public static helper so
the include guards reuse the exact add_test() config-test encoding; the
instance overloads now delegate to it.  Evaluated results are quoted via
cmScriptGenerator::Quote, while plain entries keep their raw
serialization.

Fixes: #27941
2026-07-23 18:58:04 +02:00
Brad King 42da7a30a9 Merge topic 'ctest-dyn-rsrc-spec-rel-path'
4c2d06e69b CTest: Add support for relative paths in GENERATED_RESOURCE_SPEC_FILE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12265
2026-07-23 08:56:22 -04:00
Brad King 7eb1890244 Merge topic 'cps-executable-import'
207c132378 CPS: Support importing executables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12294
2026-07-23 08:32:38 -04:00
Arha Gatram 4c2d06e69b CTest: Add support for relative paths in GENERATED_RESOURCE_SPEC_FILE 2026-07-22 09:49:28 -07:00
Brad King 9c631586d2 Merge topic 'cuda-toolkit-namespace'
f2d5320d42 FindCUDAToolkit: Add CUDAToolkit:: namespace targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12290
2026-07-22 11:32:13 -04:00
Brad King fcd200ab3b Merge topic 'diagnose-deprecated-commands'
75161b34b6 bootstrap: Remove deprecated commands
664eb8412a cmake: Don't use deprecated commands to build
3745af331a Add deprecation diagnostics to deprecated commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12277
2026-07-22 11:27:01 -04:00
Brad King 5868009096 Merge topic 'ctest-windows-jobserver-client'
79331d5865 CTest: Add Windows job server client

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12297
2026-07-22 11:23:38 -04:00
Vito Gamberini 207c132378 CPS: Support importing executables
Fixes: #27964
2026-07-22 10:45:59 -04:00
Brad King 697df9a12a Merge topic 'vs-clangcl-modules'
027b962a81 VS: Avoid unsupported ScanSourceForModuleDependencies under ClangCl

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Vito Gamberini <vito.gamberini@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !12301
2026-07-22 09:55:45 -04:00
Tyler Yankee 027b962a81 VS: Avoid unsupported ScanSourceForModuleDependencies under ClangCl
As of commit ed48feeae8 (clang-cl: Add support for C++ modules,
2026-03-27, v4.4.0-rc1~428^2) CMake tries to support modules for
clang-cl, which can mostly be accomplished, except for the ClangCl VS
toolset, where the /scanDependencies flag is not yet supported.

Amend commit 3022f0363f (VS: set ScanSourceForModuleDependencies at
vcxproj level, 2024-04-27, v3.28.5~3^2) to only emit this setting when
scanning is supported by the toolchain.

Fixes: #27957
Issue: #27977
2026-07-21 17:02:29 -04:00