Commit Graph

12404 Commits

Author SHA1 Message Date
Brad King
b91a376350 Merge topic 'configure-log-find-foo-fixes'
3ac505f79d cmFindCommon: log search path variables
e98381af21 cmFindBase: skip writing `names` and `*_directories` when empty

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10772
2025-05-19 08:31:17 -04:00
Brad King
db4e27eb64 Merge topic 'per-target-license-info'
df3e246bc1 export: Import/export target property for license

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10424
2025-05-19 08:29:12 -04:00
Brad King
2647d97ab7 cmext/enum_set: Fix static default construction on older AppleClang versions
AppleClang 8.0 and below do not understand a `= default;` constructor
in static constant default initialization, but do accept `{}`.
2025-05-16 15:03:32 -04:00
Ben Boeckel
3ac505f79d cmFindCommon: log search path variables
No pruning of variables which are not relevant is performed as it would
involve duplication of determining which paths to manage.
2025-05-15 12:24:58 +02:00
Brad King
c4b4e26019 Merge topic 'stdio-console'
ce6b0f9e10 ci: Drop unused build artifact
7cf81cdb04 Merge branch 'upstream-KWSys' into stdio-console
ad2d94cb9d KWSys 2025-05-14 (1d72955e)
40b0db5ffb cmConsoleBuf: Remove unused infrastructure
57b24e8fef StdIo: Init() automatically in Console()
3e88020aed StdIo: Replace uses of KWSys ConsoleBuf with StdIo::Console
f9f1f9a8cd StdIo: Add a Windows Console adaptor for cin, cout, and cerr

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10769
2025-05-14 10:11:23 -04:00
Daniel Tierney
df3e246bc1 export: Import/export target property for license
Add import/export support and documentation for the SPDX_LICENSE
target property. A target's license can be specified by setting
this property to an SPDX license expression. CMake and CPS-format
export files generated with `export()` or `install()` will
retain the license information. CMake also imports the license
property for imported targets.

Closes: #26706
2025-05-13 17:01:20 -04:00
Brad King
f9f1f9a8cd StdIo: Add a Windows Console adaptor for cin, cout, and cerr
On Windows, the only reliable way to read/write Unicode text from/to a
Console is to use `ReadConsoleW` and `WriteConsoleW` and convert from/to
wide-character encoding.  When `cin`, `cout`, and/or `cerr` are attached
to a Windows Console, use a custom C++ `streambuf` to handle the I/O.

This will replace KWSys ConsoleBuf, whose implementation is more complex
to support narrow output streams on Windows non-UTF-8 narrow encodings.
We only need to support UTF-8.

Issue: #26924
2025-05-13 10:35:47 -04:00
Bill Hoffman
9036aa10f3 Experimental: provide useful warning for invalid experimental variable values
Provide a useful warning if an invalid UUID is given in a
`CMAKE_EXPERIMENTAL_` variable.  This can occur if a different CMake
version is used than the one that the feature was implemented with, or
if there is a simple typo in the value.  It should reduce confusion with
the use of experimental features.

Co-authored-by: Brad King <brad.king@kitware.com>
2025-05-13 10:29:58 -04:00
Brad King
348ba701fe Tests/RunCMake/cmake_language: Expect experimental warnings more precisely 2025-05-13 10:21:26 -04:00
Brad King
4802077fb9 Merge topic 'stdio-streams'
d6a1ff59f1 StdIo: Provide metadata about stdin, stdout, stderr streams

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10759
2025-05-12 09:37:04 -04:00
Brad King
d6a1ff59f1 StdIo: Provide metadata about stdin, stdout, stderr streams
Detect the kind of terminal to which they are attached, if any.

Issue: #26924
2025-05-11 09:13:16 -04:00
Ben Boeckel
e324478e9b Tests/RunCMake/find_package: test ConfigureLog behaviors (parameters) 2025-05-09 16:46:43 +02:00
Ben Boeckel
632661795d Tests/RunCMake/find_package: test ConfigureLog behaviors (version requests) 2025-05-09 16:46:43 +02:00
Ben Boeckel
3b01fdb761 Tests/RunCMake/find_package: test ConfigureLog behaviors (version skips) 2025-05-09 16:46:43 +02:00
Ben Boeckel
63a90f13c2 Tests/RunCMake/find_package: test ConfigureLog behaviors (nested config)
Test behavior with `Find` module packages which chain to config modules.
This emulates CMake's shipped modules which support config packages
provided by modern upstreams.
2025-05-09 16:46:43 +02:00
Ben Boeckel
e594ea8dfb Tests/RunCMake/find_package: test ConfigureLog behaviors (module)
Test behavior with `Find` module packages.
2025-05-09 16:46:43 +02:00
Ben Boeckel
48575b554b Tests/RunCMake/find_package: test ConfigureLog behaviors (config)
This first test covers the basic "find a package with a config file"
behavior. Further tests will cover other behaviors.
2025-05-09 16:46:43 +02:00
Ben Boeckel
8df9819839 find_package: generate find_package-v1 configure log events
Since `find_package` is far more complex than other `find_*` commands,
it gets its own event.

Closes: #24833
2025-05-09 16:46:43 +02:00
Brad King
151a635325 Merge topic 'stdio-init'
cef4676d3a StdIo: Factor out helper to initialize stdin, stdout, and stderr

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10753
2025-05-09 09:25:01 -04:00
Brad King
6bc5d6d14f Merge topic 'cm-re-debugging'
fa1349267a cmredbg: add a tool to help debug `RunCMake` output matching

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10751
2025-05-09 09:07:20 -04:00
Brad King
cef4676d3a StdIo: Factor out helper to initialize stdin, stdout, and stderr
Move logic from commit c85524a94a (Ensure stdin, stdout, and stderr pipes
are always open, 2019-05-02, v3.15.0-rc1~171^2) and commit 96010cc968
(Ensure stdin, stdout, stderr FILE streams are open on Windows, 2024-01-24,
v3.29.0-rc1~65^2) to a dedicated source.  Expose it through an `Init` class
constructor to make it optionally available during static initialization.

Issue: #26924
2025-05-08 13:39:48 -04:00
Ben Boeckel
fa1349267a cmredbg: add a tool to help debug RunCMake output matching
Finding small errors in `RunCMake` outputs against the output is a
tedious task. Add a small tool that sets up a simple `tmux` window setup
to help debug them.
2025-05-08 13:20:44 +02:00
Hao Dong
b70ef48b27 install(DIRECTORY): Add EXCLUDE_EMPTY_DIRECTORIES option
EXCLUDE_EMPTY_DIRECTORIES option excludes empty directories under the
directory to install. A directory is considered not empty if and only if
the directory contains at least one file or one symbolic link or one
none-empty sub-directory.

Closes: #19189
2025-05-06 10:59:24 -04:00
Brad King
015cada32d Merge topic 'patch-FindProtobuf'
1bdb0ee1b8 FindProtobuf: Deprecate protobuf_generate_*() and update documentation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10742
2025-05-06 09:43:34 -04:00
Brad King
805a40b668 Optionally exclude implicit link libraries via environment
CMake detects libraries that the compiler driver implicitly passes to
the linker, and stores them in `CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES`
for use in constructing mixed-language link lines.  Some compiler driver
flags add implicitly linked libraries that should not be used during
mixed-language linking because they are handled by similar flags passed
to the other language's compiler driver.  Add an environment variable
that users can set to avoid undesired implicit link libraries in such
scenarios.

Follow the pattern from commit 023de565d3 (Optionally exclude implicit
link directories via environment, 2023-05-25, v3.27.0-rc1~54^2).

Fixes: #26911
2025-05-05 12:12:44 -04:00
Brad King
b10a2bf63a Tests/RunCMake/ParseImplicitLinkInfo: Fix ExcludeDirs test case
In commit 459d1cc095 (Tests: Verify that linker tool is detected and
identified where expected, 2023-12-13, v3.29.0-rc1~176^2) we renamed the
inspection result variables but did not update `ExcludeDirs`.
2025-05-05 12:12:37 -04:00
Peter Kokot
1bdb0ee1b8 FindProtobuf: Deprecate protobuf_generate_*() and update documentation
This deprecates the protobuf_generate_cpp() and protobuf_generate_python()
commands because the protobuf_generate() can work for both of these
cases and provides more options. Also, upstream Protobuf CMake-based
build system has marked these two commands as legacy and requires
setting a separate protobuf_MODULE_COMPATIBLE variable to boolean true
before calling the find_package(Protobuf).

Changes:
- Reworded and synced module documentation with other similar find
  modules.
- Imported targets moved to top.
- Moved examples to a separate section.
- Extended examples with basic usage and some quick hints how to upgrade
  deprecated commands to protobuf_generate().
- Used lowercase style of commands.
- Used "commands" instead of "functions" or "macros".
- Documented the DESCRIPTORS argument for protobuf_generate() command
  and added a note that this option is not available when Protobuf is
  found in config mode.
- Added a note about the Protobuf CMake-based build system and that
  probuf_generate*() commands might come from the upstream CMake config
  files. Mentioned also the protobuf_MODULE_COMPATIBLE variable from
  upstream CMake build system.
  See #21228.
  This fixes this issue in favor of #24321 which tracks further
  progress about Protobuf.
- Documented the missing `PROTOBUF_GENERATE_CPP_APPEND_PATH` variable.
  See #19968.

Issue: #24321
Fixes: #21228
Fixes: #19968
2025-05-05 09:33:32 -04:00
Brad King
8c7ab4e1e6 Merge topic 'asm-no-msvc'
14212494bb ASM: Guard exclusion of MSVC C/CXX compiler with a policy

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10740
2025-05-05 08:55:20 -04:00
Brad King
14212494bb ASM: Guard exclusion of MSVC C/CXX compiler with a policy
Since commit 6baf65ec46 (ASM: Do not consider MSVC C/CXX compiler for
generic ASM, 2025-04-08) we no longer mistake `cl` for an assembler.
However, some projects unconditionally enable ``ASM``, which worked
on Windows only due to that bug.  Restore compatibility with such
projects by guarding the change behind a new policy ``CMP0194``.

Fixes: #26907
Issue: #26617
2025-05-03 13:18:19 -04:00
Brad King
67f86c7db8 Merge topic 'clang-macos-sdk'
bf1bb62e74 macOS: Restore support for LLVM/Clang without explicit CMAKE_OSX_SYSROOT

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10734
2025-05-03 10:02:18 -04:00
Brad King
4d096781c7 Merge topic 'cuda-12.9'
031593de25 Merge branch 'backport-cuda-12.9' into cuda-12.9
6458208a26 Merge branch 'backport-cuda-12.9' into cuda-12.9
a1b4c30f24 CUDA: Add CUDA 12.9 new architectures and family syntax
b2251e0deb CUDA/Clang: Update architectures supported by CUDA 12.8

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10738
2025-05-03 09:59:33 -04:00
Brad King
031593de25 Merge branch 'backport-cuda-12.9' into cuda-12.9 2025-05-02 16:16:06 -04:00
Robert Maynard
a1b4c30f24 CUDA: Add CUDA 12.9 new architectures and family syntax 2025-05-02 15:46:49 -04:00
Brad King
bf1bb62e74 macOS: Restore support for LLVM/Clang without explicit CMAKE_OSX_SYSROOT
In commit 7b19531291 (macOS: Do not pass any SDK/-isysroot to compilers
by default, 2024-11-06, v4.0.0-rc1~511^2) we broke support for using
upstream LLVM/Clang to build for macOS because the compiler has no
default sysroot.  Handle empty `CMAKE_OSX_SYSROOT` with LLVM/Clang by
falling back to the macOS SDK reported by `xcrun --show-sdk-path` .

Fixes: #26863
2025-05-02 13:49:40 -04:00
Brad King
74e677f62b Merge topic 'clang-libstdcpp-support'
5750fcd7b4 ci: enable `import_std23` module compilation with clang
52e2785018 experimental/CXXModules: recycle the UUID
28333c4516 Clang/CXXImportStd: support `-stdlib=libstdc++`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10727
2025-05-01 08:40:49 -04:00
Brad King
f27eee63dd Merge topic 'test/GNUInstallDirs'
489884fe8d GNUInstallDirs: Make sure we test the CACHE variables
6bab9e3149 GNUInstallDirs: Add tests for reconfigure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10585
2025-05-01 08:39:37 -04:00
Brad King
6514fdebab Merge topic 'fix-cps-relative-name-mangling'
9081e73104 CPS: Fix mangling of relative requirement names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10729
2025-05-01 08:31:20 -04:00
Matthew Woehlke
9081e73104 CPS: Fix mangling of relative requirement names
CPS names look like `[package]:component`, which needs to get mangled
into `package::component` to match CMake's convention. This was
implemented correctly for fully qualified component requirements, but
relative names were not being properly mangled. Adjust handling of
relative names to correctly translate from CPS to CMake convention.
2025-04-30 11:56:09 -04:00
Cristian Le
489884fe8d GNUInstallDirs: Make sure we test the CACHE variables
Signed-off-by: Cristian Le <git@lecris.dev>
2025-04-30 16:55:23 +02:00
Cristian Le
6bab9e3149 GNUInstallDirs: Add tests for reconfigure
Signed-off-by: Cristian Le <git@lecris.dev>
2025-04-30 16:55:23 +02:00
Brad King
07a30dc075 Merge topic 'GNUInstallDirs-get-absolute-install-dir'
cc6dbd194c GNUInstallDirs: Cache CMAKE_INSTALL_* with leading usr/ for install prefix /
a7fcb1320c GNUInstallDirs: Make GNUInstallDirs_get_absolute_install_dir a function
03e796f9ab GNUInstallDirs: Move the common handler for `SYSCONFDIR` and `LOCALSTATEDIR`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10584
2025-04-30 09:52:43 -04:00
Brad King
cf54042a7c Merge topic 'externalproject-archive-types'
1cc85064ff ExternalProject: Remove explicit list of supported archive types
fb3757654e ExternalProject: Refactor local decompression test

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10715
2025-04-30 09:51:15 -04:00
Brad King
a33bb36c40 Merge topic 'cps-default-destination'
555ecfa046 Add tests for install(PACKAGE_INFO) destination

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10688
2025-04-30 09:45:55 -04:00
Ben Boeckel
52e2785018 experimental/CXXModules: recycle the UUID
Now that `clang -stdlib=libstdc++` is supported.
2025-04-30 13:48:13 +02:00
Cristian Le
cc6dbd194c GNUInstallDirs: Cache CMAKE_INSTALL_* with leading usr/ for install prefix /
As a consequence, `GNUInstallDirs_get_absolute_install_dir` does not
alter the `var` argument (the relative path argument).

Closes: #26834
Signed-off-by: Cristian Le <git@lecris.dev>
2025-04-29 13:49:42 -04:00
Javier Martín
1cc85064ff ExternalProject: Remove explicit list of supported archive types
- Do not try to guess the flags to pass to "cmake -E tar" ("z" or not) based
  on the extension. It is not necessary, as the archive type is autodetected
  since we switched to libarchive.
- Add new tests for .tar.zst archives, which would fail without the change.

Fixes: #25062
2025-04-29 11:22:13 -04:00
Brad King
e94ace226b Merge topic 'configure-log-find-v1'
a3f273b657 cmFindBase: Create `find-v1` configure log events
58b5d41a4f cmFindBase: Track initial state with an `enum`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10621
2025-04-29 10:54:10 -04:00
Brad King
456cff9ebd Merge topic 'project-compat-version'
0138df29dc project: add COMPAT_VERSION keyword

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10696
2025-04-28 11:20:01 -04:00
Taylor Sasser
555ecfa046 Add tests for install(PACKAGE_INFO) destination 2025-04-28 11:05:31 -04:00
Ben Boeckel
a3f273b657 cmFindBase: Create find-v1 configure log events
Record `find_` command events in the configure log, except
`find_package` as it is far more complicated (and will have its own
event kind).

Note that testing only generates the events of interest, there is no
verification. Also note that testing that the "found" to "notfound"
transition causes an event is not testable because a truthy value in the
variable skips any kind of verification or other logic beyond
normalization.

Co-Authored-by: Ryan Krattiger <ryan.krattiger@kitware.com>
See: #24833
2025-04-28 13:55:36 +02:00