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
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
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
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.
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
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
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
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
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
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
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.
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
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
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).
Previously our NSIS project template hard-coded `$INSTDIR\bin` for
inclusion in the `PATH`. If the directory does not exist, nothing is
done. Use `CPACK_NSIS_EXECUTABLES_DIRECTORY` instead of `bin`.
Fixes: #15635
Revert commit a324c2bb58 (GoogleTest: Base on builtin command
discover_tests, 2026-03-01, v4.4.0-rc1~30^2). The `discover_tests`
implementation does not persist already-discovered tests across ctest
runs, making it much slower on projects whose test binaries take a while
just to start up and list tests. Revert to the prior implementation
pending caching support in `discover_tests`.
Fixes: #28053
Issue: #28060
Commit c3c95f3010 (GoogleTest: Avoid generation error on duplicate
target test discovery, 2026-07-14, v4.4.1~24^2) has added a level of
indentation which made rebasing other changes harder than necessary.
Avoiding an else branch after a return command allows keeping the
original indentation.
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
Extend commit a8e7a1047a (GNU: Do not use -isystem with gfortran,
2015-03-26, v3.3.0-rc1~292^2) to cover classic Flang too. It does
not search system include directories for Fortran `.mod` files.
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
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.
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