Commit Graph

12382 Commits

Author SHA1 Message Date
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
Vito Gamberini
0138df29dc project: add COMPAT_VERSION keyword
Fixes: #26893
2025-04-25 13:42:11 -04:00
Brad King
cd7cbcc8fb Merge topic 'ctest_instrumentation_outputsizes'
2df19bec2b instrumentation: include output sizes in CTest XML

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Martin Duffy <martin.duffy@kitware.com>
Merge-request: !10712
2025-04-25 08:55:35 -04:00
Brad King
782f054ccb Merge topic 'check_language-fix'
89df8efba4 CheckLanguage: Bias compiler selection using already-enabled languages
f290240b0b CheckLanguage: Simplify test project generation
7ae8764710 Tests: Extend CMakeOnly.CheckLanguage to enable languages whose checks succeed
a049413bb6 Tests: Extend CMakeOnly.CheckLanguage to cover ASM

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10705
2025-04-25 08:54:31 -04:00
Javier Martín
fb3757654e ExternalProject: Refactor local decompression test
- Merge tests for all "other" archive types, so adding more is easier.
- Add new tests for .tar.xz archives.
2025-04-25 11:35:28 +02:00
Zack Galbreath
2df19bec2b instrumentation: include output sizes in CTest XML 2025-04-24 11:39:45 -04:00
Brad King
7ae8764710 Tests: Extend CMakeOnly.CheckLanguage to enable languages whose checks succeed 2025-04-24 08:56:00 -04:00
Brad King
a049413bb6 Tests: Extend CMakeOnly.CheckLanguage to cover ASM 2025-04-24 08:55:10 -04:00
Brad King
977634ffb5 Merge topic 'cuda_tests_no_hardcoded_sm_values'
83a0c72a2d ci: Tell CudaOnly.CompileFlags test what specific architecture to use

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10701
2025-04-24 07:43:48 -04:00
Brad King
1e6356e67f Merge topic 'cuda_tests_no_hardcoded_sm_values' into release-4.0
83a0c72a2d ci: Tell CudaOnly.CompileFlags test what specific architecture to use

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10701
2025-04-24 07:43:46 -04:00
Robert Maynard
83a0c72a2d ci: Tell CudaOnly.CompileFlags test what specific architecture to use
CUDA 12.8 deprecates architectures below 75.  Presumably a future
version will remove it.  Prepare infrastructure to avoid relying on
hard-coded arch 50 in this test.

This extends commit 63a5460faf (ci: Tell CudaOnly.Architecture test what
specific architecture to use, 2025-04-21).
2025-04-23 09:28:13 -04:00
Brad King
bf5661bb25 Merge topic 'test-ctest-regression'
6bc5b467a9 Tests: Fix RunCMake.CTestCommandLine under ctest -T Coverage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10699
2025-04-23 08:43:05 -04:00
Brad King
6bc5b467a9 Tests: Fix RunCMake.CTestCommandLine under ctest -T Coverage
Update commit 712cb8cb14 (ctest: Restore support for -T Test without
dashboard configuration, 2025-03-06, v4.0.0-rc4~11^2) to avoid
conflating coverage of CMake itself with the coverage mode of ctest
being tested.
2025-04-22 11:25:24 -04:00
Brad King
dc8ead96c2 Merge topic 'file-download-url-error'
cc2cbfc61e file: Add more context to errors from file(DOWNLOAD)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10672
2025-04-22 09:35:29 -04:00
Brad King
47f49e7b9c Merge topic 'ci-cuda'
dfe3b98387 Merge branch 'backport-ci-cuda' into ci-cuda
72e7636540 ci: add tags to tie CUDA jobs to runners with hardware supporting them
1395c1e19a ci: Tell CudaOnly.Architecture test what specific architecture to use
4f2178c4a8 ci: add tags to tie CUDA jobs to runners with hardware supporting them
63a5460faf ci: Tell CudaOnly.Architecture test what specific architecture to use

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10691
2025-04-22 09:22:20 -04:00
Brad King
680cd7634b Merge topic 'ci-cuda' into release-4.0
dfe3b98387 Merge branch 'backport-ci-cuda' into ci-cuda
72e7636540 ci: add tags to tie CUDA jobs to runners with hardware supporting them
1395c1e19a ci: Tell CudaOnly.Architecture test what specific architecture to use
4f2178c4a8 ci: add tags to tie CUDA jobs to runners with hardware supporting them
63a5460faf ci: Tell CudaOnly.Architecture test what specific architecture to use

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10691
2025-04-22 09:22:19 -04:00
Brad King
cd44c127ef Merge topic 'FindPython-SABI_LIBRARY-definition'
25cbaf162f Merge branch 'backport-FindPython-SABI_LIBRARY-definition'
bd7a27bcc7 FindPython: fix the definition of SABI artifacts
554ef95470 FindPython: fix the definition of SABI artifacts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10687
2025-04-22 09:15:36 -04:00
Brad King
1395c1e19a ci: Tell CudaOnly.Architecture test what specific architecture to use
CUDA 12.8 deprecates architectures below 75.  Presumably a future
version will remove it.  Prepare infrastructure to avoid relying on
hard-coded arch 52 in this test.
2025-04-21 18:24:41 -04:00
Brad King
63a5460faf ci: Tell CudaOnly.Architecture test what specific architecture to use
CUDA 12.8 deprecates architectures below 75.  Presumably a future
version will remove it.  Prepare infrastructure to avoid relying on
hard-coded arch 52 in this test.
2025-04-21 18:07:15 -04:00
Marc Chevrier
bd7a27bcc7 FindPython: fix the definition of SABI artifacts
Fixes: #26881
2025-04-21 11:47:49 -04:00
Marc Chevrier
554ef95470 FindPython: fix the definition of SABI artifacts
Fixes: #26881
2025-04-21 16:14:51 +02:00
Brad King
15daf279f2 Merge topic 'swift-warning-as-error'
dfa78c4868 Swift: Honor COMPILE_WARNING_AS_ERROR for command-line build systems

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10660
2025-04-21 09:38:45 -04:00
Martin Duffy
cc2cbfc61e file: Add more context to errors from file(DOWNLOAD) 2025-04-18 13:30:05 -04:00