Commit Graph
16250 Commits
Author SHA1 Message Date
Brad King 1ece2660b2 Merge topic 'drop-import-std-gate'
4874f044bd Experimental: Remove import std experimental gate
b65a094a31 c++modules: Don't set CMAKE_CXX_STDLIB_MODULES_JSON if the file does not exist

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Sharadh Rajaraman <r.sharadh@outlook.sg>
Merge-request: !12547
2026-09-28 08:36:27 -04:00
Vito Gamberini 4874f044bd Experimental: Remove import std experimental gate
Fixes: #28014
2026-09-25 11:03:02 -04:00
Brad King e37c9d16e3 Merge topic 'LLVMFlang-Apple-link-flags'
18d65b9d4b LLVMFlang: Fix Fortran shared library creation on Apple platforms

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12546
2026-09-25 10:01:40 -04:00
Brad King 550bce7ca1 Merge topic 'fortran-subdir-mingw64'
d811fc9193 CMakeAddFortranSubdirectory: Search for MinGW-W64 gfortran in a common path
52039e20d1 CMakeAddFortranSubdirectory: Avoid redundant check for Fortran support
06b21a6e48 CMakeAddFortranSubdirectory: Use canonical ExternalProject_Add capitalization
d3ebafb22f CMakeAddFortranSubdirectory: Clarify documentation and improve its layout

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12535
2026-09-25 10:00:02 -04:00
Brad King 50acc38f3d Merge topic 'FindCUDAToolkit-tolerate-nvcc'
96782dad33 FindCUDAToolkit: Avoid error when nvcc is found without the whole toolkit

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12557
2026-09-25 09:50:04 -04:00
Brad King 9ae90c2e03 Merge topic 'gfortran-isysroot'
cc6bcefc6a Apple: Restore detection of platform-specific GNU Fortran flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12548
2026-09-25 09:46:42 -04:00
Brad King 0d9ae117f5 Merge topic 'externalproject-install-prefix'
2b07afa1a1 ExternalProject: Default CMAKE_INSTALL_PREFIX to INSTALL_DIR

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12486
2026-09-25 09:42:41 -04:00
Brad King 96782dad33 FindCUDAToolkit: Avoid error when nvcc is found without the whole toolkit
Since commit 507b641639 (FindCUDAToolkit: Add cufilt target for CUDA
11.4 and above, 2026-05-27, v4.4.0-rc1~62^2) we try to construct an
imported target for `cufilt` whenever `nvcc` is found even if the
toolkit is not found.  Fix conditions to avoid that.
2026-09-24 13:26:07 -04:00
Julien Marrec d811fc9193 CMakeAddFortranSubdirectory: Search for MinGW-W64 gfortran in a common path
Binaries provided by https://github.com/niXman/mingw-builds-binaries
are installed by GitHub Actions to `c:/mingw64`.

Fixes: #28106
2026-09-23 14:37:04 -04:00
Julien Marrec 52039e20d1 CMakeAddFortranSubdirectory: Avoid redundant check for Fortran support
If `MINGW_GFORTRAN` is already set, do not `check_language(Fortran)`.
2026-09-23 14:36:38 -04:00
Julien Marrec 06b21a6e48 CMakeAddFortranSubdirectory: Use canonical ExternalProject_Add capitalization 2026-09-23 14:35:34 -04:00
Brad King d3ebafb22f CMakeAddFortranSubdirectory: Clarify documentation and improve its layout 2026-09-23 14:30:41 -04:00
Matthew Thompson 18d65b9d4b LLVMFlang: Fix Fortran shared library creation on Apple platforms
LLVMFlang requires Apple-specific linker options to be forwarded through
`-Xlinker`.

Fixes: #27558
2026-09-23 13:55:56 -04:00
Brad King 01b4728ae1 Merge topic 'CheckLanguage-timeout'
eb33b390e4 CheckLanguage: Avoid hanging forever on interactive popups

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12533
2026-09-23 13:42:33 -04:00
Vito Gamberini b65a094a31 c++modules: Don't set CMAKE_CXX_STDLIB_MODULES_JSON if the file does not exist 2026-09-23 10:23:34 -04:00
Brad King cc6bcefc6a Apple: Restore detection of platform-specific GNU Fortran flags
Detection of `-isysroot` was broken by commit a1b5c0da87 (Modules:
Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL, 2026-05-05,
v4.4.0-rc1~209^2~1) because `gfortran -v --help` returns non-zero.

Fixes: #28111
2026-09-23 10:04:30 -04:00
15daksh-2003 2b07afa1a1 ExternalProject: Default CMAKE_INSTALL_PREFIX to INSTALL_DIR
The default CMake configure command never set an install prefix, so
external projects installed to /usr/local rather than the INSTALL_DIR
the module already reserves. Add policy CMP0225 to pass it by default;
an explicit prefix from the caller still takes precedence.

Fixes: #27050
2026-09-23 18:41:33 +05:30
Julien Marrec eb33b390e4 CheckLanguage: Avoid hanging forever on interactive popups
Fixes: #28101
2026-09-22 11:47:26 -04:00
Brad King d37a1fc335 Merge topic 'automoc-predefs-msvc'
7c3ca57b91 MSVC,Clang: Set CMAKE_CXX_COMPILER_PREDEFINES_COMMAND for the MSVC ABI
0fd711348c Autogen: Pass WIN32 to moc when targeting the MSVC ABI
4a4a654814 Autogen: Keep stderr out of the generated moc_predefs.h
1c1258ad95 cmWorkerPool: Allow capturing process stderr separately

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12517
2026-09-22 10:14:46 -04:00
Taylor Braun-JonesandTyler Yankee 5cced02b9d CTest: Repeat test fixtures with the tests that require them
When ctest repeats tests with its --repeat option, it repeats each test
on its own.  A fixture's setup and cleanup tests therefore run all of
their repetitions back to back, and the tests they bracket repeat inside
a single setup/cleanup pair:

  setup -> setup -> test -> test -> cleanup -> cleanup

Add a FIXTURE_REPEAT_MODE test property to select how a fixture behaves
when its tests are repeated:

* AROUND_ALL_REPEATS: the fixture runs once, around all repetitions of
  the tests requiring it.
* AROUND_EACH_REPEAT: the fixture and the tests requiring it repeat
  together, so every repetition gets a fresh setup and its own cleanup.
* EACH_TEST_SEPARATELY: every test repeats on its own, as before.

The property describes the fixture rather than the test carrying it, so
setting it on any one of a fixture's setup or cleanup tests is enough.

In AROUND_EACH_REPEAT mode the tests of a fixture form a repeat group that
ctest re-queues as a whole once every test in it has finished.  The --repeat
condition then applies to the group the way it applies to an individual
test: until-fail repeats while the whole group passes, until-pass repeats
while any of it does not, and after-timeout repeats while any of it times
out.  Fixtures that share a test repeat together, so a test requiring two of
them still runs once per repetition.

A group is recorded the way a repeating test is: only once it stops
repeating, and with the results of its last repetition.  A group that
until-pass makes pass therefore reports a pass rather than the failure that
made it repeat, a test that DEPENDS on one of the group's tests waits for
the last repetition rather than the first, and `ctest -F` resumes an
interrupted group by running it again from the beginning.

Fixtures that repeat together have to agree on the mode: a test cannot
repeat with one fixture but not with another it takes part in, and a fixture
whose setup and cleanup tests disagree has no coherent behavior.  Report an
error and run nothing in those cases rather than pick an order in which a
test repeats after a fixture it requires has been cleaned up.

Add policy CMP0224 to select AROUND_EACH_REPEAT as the default for fixtures
whose setup and cleanup tests choose no mode themselves.  Record the mode
the policy chose in the generated test file under its own
_CMAKE_DEFAULT_FIXTURE_REPEAT_MODE keyword, so that ctest reads a mode
rather than the policy settings behind it, and so that a mode requested on
one of a fixture's tests wins over the default recorded for its siblings.
Only NEW needs recording: with nothing recorded, ctest already uses the
behavior of CMake 4.4 and below.  Fixtures are common, and the choice of
mode matters only to those who run ctest --repeat, so warn about the unset
policy only when the CMAKE_POLICY_WARNING_CMP0224 variable asks for it.

discover_tests() and gtest_discover_tests() create their tests while ctest
runs or at build time, too late for the policy to reach them, so carry the
setting in effect at their call sites through to the tests they create.

Report the repetition a grouped test belongs to in the "(run N/M)" suffix
of its "Start" line, as ctest already does for a test repeating on its own.

Co-authored-by: Tyler Yankee <tyler.yankee@kitware.com>
Fixes: #21438
2026-09-18 08:29:28 -04:00
Brad King 18fac8b212 Merge topic 'compiler-binutils'
047c617a77 Modules/Compiler: Prefer companion tools adjacent to compiler
ccf42522b8 Modules/Compiler: Improve formatting of code finding companion tools

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !12510
2026-09-18 08:09:00 -04:00
Joerg Bornemann 7c3ca57b91 MSVC,Clang: Set CMAKE_CXX_COMPILER_PREDEFINES_COMMAND for the MSVC ABI
The variable was only set by the GNU-like compiler modules, so AUTOMOC
never generated a moc_predefs.h for compilers targeting the MSVC ABI
and moc parsed headers without the compiler's predefined macros.

MSVC dumps its predefined macros with '/PD', which needs the conforming
preprocessor. Require VS 2019 16.8, because 16.7 and older ignore the
flag with warning D9002 and emit no macros at all. clang-cl takes '-dM'
through '-Xclang'. Both also echo the preprocessed source, so feed them
an empty translation unit. clang with the GNU driver is excluded from
'Compiler/GNU' as well when it simulates MSVC, so give it the usual
'-dM -E' command there.

Fixes: #28093
2026-09-18 11:35:02 +02:00
Tyler Yankee b63bcda722 CUDA, HIP: Revert false support for LINKER_LAUNCHER
The implementation in commits 77312cc6 (CUDA: Add support for
[CMAKE_]CUDA_LINKER_LAUNCHER, 2025-05-30, v4.1.0-rc1~80^2~1) and
cdf2a36f (HIP: Add support for [CMAKE_]HIP_LINKER_LAUNCHER, 2025-05-30,
v4.1.0-rc1~80^2) is broken, and the tests are wrongly configured
so as to never actually run. Revert the entire feature to avoid future
confusion, including documented support.

Enable the test for Fortran, which was added but untested by commit
d176a8c5ce (Fortran: Add support for [CMAKE_]Fortran_LINKER_LAUNCHER,
2025-05-26, v4.1.0-rc1~96^2), and whose implementation works.

Issue: #26967
2026-09-17 18:07:42 -04:00
Brad King 047c617a77 Modules/Compiler: Prefer companion tools adjacent to compiler
Previously a versioned name in a later search path was preferred
over an unversioned name adjacent to the compiler.  Consider all
names in each directory before moving to the next directory.
2026-09-15 08:46:25 -04:00
Brad King ccf42522b8 Modules/Compiler: Improve formatting of code finding companion tools 2026-09-15 08:43:43 -04:00
Brad King 246e72e4a9 Help: Replace OpenBLAS links with their permanent redirects 2026-09-15 08:23:58 -04:00
Craig Scott d410092ece FetchContent: Move log level detection into step script
A step with a custom command shouldn't be seen as out-of-date
just because the user re-runs configure with a different log level.
Previously, the log level was written directly to the step scripts,
but that meant the script changes if the user specifies a different
effective log level to the previous configure. Now we move the
log level detection into the script so that the script remains the
same no matter what log level the user asks for.

This was most noticeable with the PATCH step, since that always
uses a custom command when present. Changing the log level
would cause the PATCH step to re-run, which usually results in
an error because PATCH typically only expects to run once after
a DOWNLOAD. But the underlying problem would affect any step
with a custom command, not just PATCH.

Fixes: #28055
2026-09-13 21:23:27 +10:00
Brad King 4b2cf13e42 Merge topic 'findpkgconfig-l-colon'
0cc8f00e6b FindPkgConfig: support GNU ld -l:<file> exact-file syntax

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12485
2026-09-09 13:25:27 -04:00
Brad King ad9bc7bf17 Merge topic 'blas-lapack-nvpl'
d8ade0500e Find{BLAS,LAPACK}: Provide full paths in `{BLAS,LAPACK}_LIBRARIES` with NVPL
cdf4234bc4 Find{BLAS,LAPACK}: Only search for the needed components of NVPL

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12484
2026-09-09 13:23:29 -04:00
Brad King 171d3120de Merge topic 'doc-blas-lapack-libraries'
b2feea6f38 Find{BLAS,LAPACK}: Document intended usage of `_LIBRARIES` more precisely

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12491
2026-09-08 09:57:18 -04:00
Brad King 9f69b22d30 Merge topic 'FindBLAS-mkl-fortran'
7fc5446d66 FindBLAS: Fix MKL Fortran API selection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12479
2026-09-08 09:55:59 -04:00
Brad King fd80f621a5 Merge topic 'FindBLAS-mkl-threading'
f49e24f150 FindBLAS: Select MKL threading layer based on the OpenMP runtime library
e4a3ef7f8b FindBLAS: Select Intel MKL Fortran ABI and threading runtime independently

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12480
2026-09-08 09:51:21 -04:00
Ye Luo d8ade0500e Find{BLAS,LAPACK}: Provide full paths in {BLAS,LAPACK}_LIBRARIES with NVPL
Documentation as of CMake 4.4.3 states that these variables provide full
paths to libraries, so some existing consumers expect it.

NVPL provides imported targets that set `IMPORTED_LOCATION_RELEASE`.

Fixes: #28073
2026-09-07 12:37:49 -04:00
Ye Luo cdf4234bc4 Find{BLAS,LAPACK}: Only search for the needed components of NVPL 2026-09-07 12:37:49 -04:00
15daksh-2003 0cc8f00e6b FindPkgConfig: support GNU ld -l:<file> exact-file syntax
Some .pc files (e.g. DPDK) use -l:libfoo.a for an exact library file, but
we passed the colon to find_library and it never resolved. Strip it for
lookup, keep the token so an unresolved lib still falls back to -l:.

Fixes: #27452
2026-09-07 21:28:11 +05:30
Brad King b2feea6f38 Find{BLAS,LAPACK}: Document intended usage of _LIBRARIES more precisely
Remove the outdated promise of absolute paths in `_LIBRARIES`.
The "using full path name" phrasing was left from before imported
targets were a thing.

Issue: #28073
2026-09-07 11:20:04 -04:00
Ye Luo f49e24f150 FindBLAS: Select MKL threading layer based on the OpenMP runtime library
Fixes: #28072
2026-09-07 10:39:21 -04:00
Ye Luo 7fc5446d66 FindBLAS: Fix MKL Fortran API selection
Fixes: #28071
2026-09-07 10:35:54 -04:00
Ye Luo e4a3ef7f8b FindBLAS: Select Intel MKL Fortran ABI and threading runtime independently 2026-09-07 10:30:34 -04:00
Brad King 61a5b7846b Merge topic 'clang-cuda-offload-linker'
5b416cbe77 ci: add job testing cuda13.2 with clang
64dac60df9 ci: Update cuda13.2-x86_64 base image to clang-23
ce3d0af576 Clang/CUDA: Support the llvm23+ offload linker model

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12052
2026-09-07 08:45:35 -04:00
Brad King 67a9fda3f1 Merge topic 'implicit-link-info-separated-l-flag'
8eb3e61e5c CMakeParseImplicitLinkInfo: Fix parsing of -l flags with separated value

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12477
2026-09-07 08:43:55 -04:00
Robert Maynard ce3d0af576 Clang/CUDA: Support the llvm23+ offload linker model
Fixes: #26120, #26810
2026-09-03 13:26:45 -04:00
Jacob Lambert 64a4a0c9a8 HIP: Detect default architecture from the AMDGPU subarch triple
Otherwise, `project(LANGUAGES HIP)` fails to configure on a machine
with no AMD GPU when using Clang 22 or newer:

  Failed to find a default HIP architecture.

The default architecture is determined by running `rocm_agent_enumerator`,
which returns nothing when no GPU is present, and then by matching
` -target-cpu ([a-z0-9]+) ` in the compiler's cc1 output.  Clang stopped
passing `-target-cpu` for AMDGPU in LLVM/Clang commit bf9fe776748c
(clang/AMDGPU: Stop passing redundant -target-cpu to cc1, 2026-08-31);
the processor is now carried in the triple's subarch field.  Neither
path matches, so configuration fails.

Fall back to reading the subarch out of the triple, e.g.,
`amdgpu9.06-amd-amdhsa` for `gfx906`.  Keep the `-target-cpu` branch for
older compilers.  Generic targets spell the subarch with fewer
components, e.g., `amdgpu10.3--` for `gfx10-3-generic`.  Those are not
matched, so they still reach the existing error rather than producing an
invalid architecture name.
2026-09-03 12:05:25 -04:00
Brad King 8eb3e61e5c CMakeParseImplicitLinkInfo: Fix parsing of -l flags with separated value
`clang-linker-wrapper` prints `-l cudadevrt` instead of `-lcudadevrt`.
We already handle this for `-L` flags.
2026-09-02 15:45:04 -04:00
Brad King 981f5b5f71 Merge topic 'clang-arm64x'
ea378e104d Windows: Detect both ARM64 and ARM64EC with Clang -marm64x flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12464
2026-09-02 09:16:19 -04:00
Brad King ea378e104d Windows: Detect both ARM64 and ARM64EC with Clang -marm64x flag
Both architectures appear in object files, so add both of them to
`CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID` too.  We already do this for
multiple `CMAKE_OSX_ARCHITECTURES` on Apple platforms.

Fixes: #28067
2026-09-01 17:47:27 -04:00
Brad King 417fed9562 MinGW: Fix implicit link info detection with spaces in toolchain path
The `gcc -v -Wl,-v` debug output does not quote or escape spaces, so
`separate_arguments(... NATIVE_COMMAND ...)` separates on spaces in
paths.  Separate on ` -L` and ` -l` instead.

Fixes: #28056
2026-09-01 14:55:01 -04:00
Brad King baec7315b5 CMakeParseImplicitLinkInfo: Avoid using GCC's "Configured with" line
The `gcc -v` output includes a "Configured with" line about its own
build environment.  Use it only for the fallback from commit 78b7ba6494
(LinkerId: Fix detection of linker tool for GNU on SunOS sparc32,
2023-12-19, v3.29.0-rc1~176^2~8).
2026-09-01 14:42:46 -04:00
Brad King 8e49148617 Merge topic 'llvmflang-compile-warn-error'
32c8a4bd01 LLVMFlang: Add support for COMPILE_WARNING_AS_ERROR

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12455
2026-09-01 10:41:59 -04:00
scivision 32c8a4bd01 LLVMFlang: Add support for COMPILE_WARNING_AS_ERROR
LLVM/Flang has supported `-Werror` since version 13.
2026-08-31 12:05:01 -04:00