Commit Graph
1442 Commits
Author SHA1 Message Date
Brad King 6f383662d5 Merge topic 'ctest_name_output_dir'
ad6be5a4dd CTest: Add an option to set the output directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12635
2026-10-23 09:38:48 -04:00
Tom Osika ad6be5a4dd CTest: Add an option to set the output directory
CTest writes the files it produces during a run -- the TAG file, the
logs under Temporary, and the XML files staged for submission -- into a
single directory, which was always "Testing" under the build tree.  Two
ctest processes sharing a build tree therefore overwrite each other's
output.

Add a --output-dir command-line option, and a CTEST_OUTPUT_DIRECTORY
variable for dashboard scripts, to select that directory.  It defaults
to the previous location, may be outside the build tree, and resolves a
relative path against the binary directory.

Issue: #27518
2026-10-22 18:17:33 +00:00
Daksh Mamodiya 7f66b33643 Help: Document CMAKE_FIND_ROOT_PATH_MODE_* default
The variable pages never said what happens when the mode isn't set.
The find commands fall back to BOTH.  The mode descriptions also only
talked about CMAKE_FIND_ROOT_PATH, but CMAKE_SYSROOT is re-rooted the
same way, and ONLY still searches under CMAKE_STAGING_PREFIX.

Fixes: #27298
2026-10-22 20:52:27 +05:30
Daksh Mamodiya 402ca0d619 Help: Move ctest BuildName and Site settings to Start step
ctest_start initializes these from CTEST_BUILD_NAME and CTEST_SITE, and
ctest_submit doesn't re-read them.  Listing them under the Submit step
suggested they could be set just before submitting.  Also noted this on
the CTEST_BUILD_NAME and CTEST_SITE variable pages.

Fixes: #28195
2026-10-21 13:44:36 +05:30
Baudouin Feildel 60f3158c30 Rust: Add support for Rust compiler launcher 2026-10-18 16:07:23 +02:00
Brad King 2918f600a2 Merge topic 'pch-warnings'
cec0ec5273 PCH: Add PCH_WARNINGS property to get warnings from precompiled headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12616
2026-10-16 10:29:09 -04:00
Brad King d2025fc8f0 Merge topic 'enable-test_prep-by-default'
4bbdabae74 Ninja, Makefile, FASTBuild: Enable test_prep by default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12638
2026-10-15 10:48:16 -04:00
Matthew Woehlke 4bbdabae74 Ninja, Makefile, FASTBuild: Enable test_prep by default
Enable test preparation targets by default. Add (better named)
`CMAKE_SKIP_TEST_PREP_TARGETS` variable to control generation of the
same, mirroring `CMAKE_SKIP_INSTALL_PREP_TARGETS`. Remove support for
old `CMAKE_TEST_BUILD_DEPENDS` variable. Update and improve
documentation.

This improves consistency between test and install preparation targets.
It also modifies the descriptions of preparation targets in the
documentation of generators which support them to be consistent.
(Previously, each generator described preparation targets in a manner
unique to each generator.)

Fixes: #28050
2026-10-14 16:10:45 -04:00
Brad King 7c479bd3e4 Merge topic 'add-dpclang'
c7ab581812 ci: Add job testing DPClang on Linux
4ea5eba8de ci: Add scripts to install DPClang in Linux jobs
21213ae1d9 DPClang: add compiler support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12634
2026-10-14 10:39:42 -04:00
Cristian Adam cec0ec5273 PCH: Add PCH_WARNINGS property to get warnings from precompiled headers
The generated precompiled header is marked as a system header, which
suppresses the diagnostics of every header it includes.  Enabling
precompiled headers therefore silently hides warnings that the same
build
would produce without them.

Move the pragma out of CMAKE_PCH_PROLOGUE into its own
CMAKE_PCH_SYSTEM_HEADER_PRAGMA variable so that it can be omitted
independently of the user-facing prologue and epilogue, and add a
PCH_WARNINGS target property, initialized by CMAKE_PCH_WARNINGS, to omit
it.  The diagnostics are then reported once, while compiling the
precompiled header itself.

Fixes: #21219
2026-10-14 07:32:04 +02:00
Vito Gamberini 21213ae1d9 DPClang: add compiler support
Fixes: #28157
2026-10-13 14:59:23 -04:00
Tyler Yankee 67f253a8d2 Help: Factor out "may use generator expressions"
This had already been factored out to `GENEX_NOTE.rst`, but wasn't
applied very widely. Consolidate the language to consistently spell out
(a) the reference to `cmake-buildsystem(7)` and (b) the prose 'with the
syntax "$<...>"'.

To accompany the change, modify cmRST to override redefinitions of
substitutions within a single context instead of appending. Otherwise,
with the new note files, `cmake --help-*` prints repeated fragments
when it collates all scopes of a given field (e.g., all
`prop_*/COMPILE_OPTIONS.rst` from
`cmake --help-property COMPILE_OPTIONS`).
2026-10-13 11:46:56 -04:00
Tyler Yankee c3bdc4476f Help: Factor out XCODE_GENERATE_SCHEME reference 2026-10-13 10:32:21 -04:00
Tyler Yankee 94198532db Help: Factor out cmake-compile-features(7) reference 2026-10-13 10:32:20 -04:00
Taylor SasserandTyler Yankee 0ea2d28b54 Ninja: Add install_prep targets for minimal builds
Add `install_prep/<component>` convenience targets to the Ninja
generators to build dependencies of install components, and
`install_prep/all` to build the dependencies of all install components.

This is similar in flavor to commit ba6b6fbc24 (Ninja: Add Build
Dependencies for Tests, 2026-04-07), but here for the install command.

Co-authored-by: Tyler Yankee <tyler.yankee@kitware.com>
Issue: #27643
2026-10-12 12:23:46 -04:00
Tyler YankeeandTaylor Sasser 2a67f00fc8 Help: Add target names description to cmake-buildsystem(7)
Co-authored-by: Taylor Sasser <taylor.sasser@kitware.com>
2026-10-12 12:23:44 -04:00
Vito Gamberini f69754ad63 SYCL: Initial language implementation
Add experimental support for SYCL under an experimental gate. The
IntelLLVM and Adaptivecpp compilers are recognized, as well as upstream
Clang with libsycl support.

Fixes: #27219, #27905
2026-10-07 11:43:31 -04:00
Brad King eee17b260c Merge topic 'doc-test-prep-discovery'
68d889a299 Help: Polish discover_tests with build dependencies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12597
2026-10-06 10:36:38 -04:00
Tyler Yankee 68d889a299 Help: Polish discover_tests with build dependencies
Add a release note and version information pertaining to commit
463517fddd (ctest: Support Test Dependencies for discover_test modules,
2026-08-18).
2026-10-05 11:59:45 -04:00
Vito Gamberini ac25d58e72 Experimental: Remove SBOM experimental gate
Fixes: #28117
2026-10-04 22:22:55 -04:00
Vito Gamberini 230a6821ed SBOM: Validate and document CMAKE_INSTALL_SBOM_FORMATS
Use the same format parser as install(SBOM) and export(SBOM), and reject
unknown formats.
2026-10-04 22:22:34 -04:00
Brad King f57f2a5acb Merge topic 'windows-library-path-per-lang'
89e5c19c55 Linker: Generate per-language link directory flags on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12588
2026-10-02 10:27:33 -04:00
Brad King 3fadb7a600 Merge topic 'discover-test-deps'
463517fddd ctest: Support Test Dependencies for discover_test modules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12413
2026-10-01 10:41:29 -04:00
Daksh Mamodiya 89e5c19c55 Linker: Generate per-language link directory flags on Windows
IntelLLVM links through the compiler driver, so its link directory
flag is wrapped in `/Qoption,link,`.  MSVC and CUDA run `link.exe`
directly.  When both are used in one build tree, the IntelLLVM value
of `CMAKE_LIBRARY_PATH_FLAG` leaked onto `link.exe` command lines.
Setting `CMAKE_<LANG>_LIBRARY_PATH_FLAG` per language, as was done
for `CMAKE_<LANG>_LINK_DEF_FILE_FLAG`, gives each link line the
spelling its own linker understands.  The variable is now documented.

Fixes: #28116
2026-10-01 15:37:42 +05:30
Martin Duffy 463517fddd ctest: Support Test Dependencies for discover_test modules
- Update discover_tests to work with test_prep targets and ctest --out-of-date
- Extend behavior to gtest_discover_tests
- Don't treat non-built targets as always out of date
- Support imported targets in BUILD_DEPENDS

Issue: #28052, #28070
2026-09-30 09:26:58 -04:00
Tyler YankeeandJoseph Snyder c355bd02e4 Ninja, Makefile: Add compile and link wrapper usage requirements
Introduce new properties which allow target-specific wrapping of
compile and link commands with arbitrary command lines. This is similar
to the existing compiler and linker launchers, except the new
`INTERFACE` compile and link wrappers allows expression as usage
requirements.

Wrappers are more flexible than launchers with regard to having
multiple belonging to a given target, either from the target itself or
dependent(s). In such cases, wrappers precede launchers on the
resulting command line (so as to not interfere with tools like
`ccache`), and are sorted lexicographically by the name of the
corresponding CMake global property containing their value.

Co-authored-by: Joseph Snyder <joseph.snyder@kitware.com>
Issue: #27402, #28110
Fixes: #27598
2026-09-30 07:51:22 -04:00
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 614098f64b Merge topic 'ctest-resource-error-action'
7174aa5978 CTest: make test result for insufficient resources configurable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12541
2026-09-25 10:15:29 -04:00
15daksh-2003 9ca821ca68 CMAKE_DL_LIBS: Clarify which functions the variable covers
The docs only mentioned dlopen() and dlclose(), which reads as if code
calling just dlsym(), dladdr(), etc. doesn't need it.  It does on glibc
before 2.34.

While at it, dropped SunOS from the empty-value examples (it gets "dl")
and listed the current AIX value.

Fixes: #28088
2026-09-23 22:12:38 +05:30
Frank Winklmeier 7174aa5978 CTest: make test result for insufficient resources configurable
Add the `RESOURCE_ERROR_ACTION` test property to configure the action in
case test resources cannot be satisfied. Currently it supports `FAIL`
(default) and `SKIP`.

Also add the `CTEST_RESOURCE_ERROR_ACTION` variable, which can be used
to set the default behavior for all tests.

Fixes: #28095
2026-09-23 11:26:43 +02:00
Brad King 2020c66db9 Merge topic 'ctest-fixture-repeat'
5cced02b9d CTest: Repeat test fixtures with the tests that require them
4fcf3dd296 CTest: Ignore a checkpoint entry for a test that is not pending
32b25b94d6 CTest: Track one run number for a repeating test

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11638
2026-09-22 10:01:43 -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
Tyler Yankee 584a9297c0 CUDA, HIP: Restore support for LINKER_LAUNCHER
Reapply the implementation in commits 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).

Add a special case to expand the correct rule placeholder for these
languages, which is spelled `CMAKE_<LANG>_HOST_LINK_LAUNCHER`. Enable
the tests for these languages correctly. Re-document support under
CMake 4.5.

Fixes: #26967
2026-09-17 18:11:42 -04:00
Tyler Yankee aeb7c3295d Merge branch 'backport-test-langs-launchers' into test-langs-launchers 2026-09-17 18:08:42 -04: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
15daksh-2003 5da34d2f45 Help: link CMAKE_SYSTEM_NAME script-mode note to CMAKE_HOST_SYSTEM_NAME
Fixes: #27085
2026-09-07 19:22:49 +05:30
Brad King 6408fe4171 Help: Document MinGW ARM64 Emulation Compatible architecture id
The `arm64ec` value was added by commit 7f0f382c55 (Provide
CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID on more compilers, 2025-03-24,
v4.1.0-rc1~499^2) but not documented.

Note that the Clang `-marm64x` flag can produce `aarch64;arm64ec`.

Issue: #28067
2026-09-02 12:05:20 -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 ff3a0e7ef4 Merge topic 'docs-cannot-change-toolchain-file'
c9868a61be Help: Mention that CMAKE_TOOLCHAIN_FILE cannot be changed

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12434
2026-08-25 11:35:23 -04:00
Aiden Woodruff c9868a61be Help: Mention that CMAKE_TOOLCHAIN_FILE cannot be changed 2026-08-25 09:38:59 -04:00
Brad King 244b563b43 Merge topic 'autogen-vs-reduce-target-count'
d963b87ab4 Autogen: Reduce the number of targets under Visual Studio
2b5ad7e395 Autogen: Register per-config timestamp file with its full path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12409
2026-08-24 12:31:33 -04:00
Joerg Bornemann d963b87ab4 Autogen: Reduce the number of targets under Visual Studio
Commit 680fbb112a (Autogen: Enable depfile support for Visual Studio and
Xcode generators) disabled the PRE_BUILD optimization when a depfile is
used, because a PRE_BUILD event cannot carry depfile dependencies. Since
then, every target with AUTOMOC or AUTOUIC enabled gains an
'<ORIGIN>_autogen' and an '<ORIGIN>_autogen_timestamp_deps' target,
which the Visual Studio generators turn into two extra projects per
target in the generated solution.

Attach the autogen custom command to the origin target instead. The
custom command still carries the depfile, and the dependencies of the
origin target provide the ordering that
'<ORIGIN>_autogen_timestamp_deps' provides otherwise, because MSBuild
builds all referenced projects before any step of the referencing
project.

Use the conditions of the PRE_BUILD event, so that the
'<ORIGIN>_autogen' target keeps existing wherever it existed before
depfiles were enabled for the Visual Studio generators. In particular,
projects that name the target in add_dependencies() keep working.

Ninja and the Makefile generators keep the separate targets. Extra
targets have no cost for them, and '<ORIGIN>_autogen' has always existed
there.

The Xcode generator gained the same two targets per origin target in
4.4, but attaching the custom command there needs some more thoughts on
the per-config timestamp file first: Xcode rejects targets whose sources
vary by configuration, and with AUTOGEN_BETTER_GRAPH_MULTI_CONFIG the
timestamp file is per configuration.

Fixes: #28034
Fixes: #28033
2026-08-14 13:14:54 +02:00
Robert Maynard a2e6306c27 GenEx/LINK_LIBRARY: Add NEEDED_LIBRARY support on Linux 2026-08-13 13:45:19 -04:00
Brad King 6491bd5a5f Help: Format LINK_LIBRARY NEEDED_LIBRARY platforms as a definition list
This will make it easier to add more platforms.
2026-08-13 13:45:04 -04: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
Vito Gamberini ab1bd6f6c6 c++modules: Remove CXX_MODULE_STD and CMAKE_CXX_COMPILER_IMPORT_STD
Fixes: #27966, #27992, #28000
2026-08-03 10:05:34 -04:00
Brad King 92fbd6d0e0 Merge topic 'reduce-utf-8'
96b3a4e6c7 Style: Replace some UTF-8 characters with ASCII equivalents

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12319
2026-07-27 09:56:23 -04:00
Brad King 96b3a4e6c7 Style: Replace some UTF-8 characters with ASCII equivalents 2026-07-24 09:55:14 -04:00
Brad King 4212dce181 Merge topic 'doc-ide-compiler-selection'
90e2a33dba Help/CMAKE_LANG_COMPILER: Document Visual Studio, Xcode, GHS generators quirks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12296
2026-07-22 09:52:31 -04:00