Commit Graph

1370 Commits

Author SHA1 Message Date
Brad King
1c4ef7291f Merge topic 'cmake-diagnostics-doc'
95f7f84609 Help: Fix CMD_INSTALL_ABSOLUTE_DESTINATION documentation
a882ec84ec cmDocumentation: Add diagnostics
97d13c3053 Help: Improve diagnostics documentation
3cccce8ca2 Help: Add developer documentation for new diagnostics
ffe4c2a8ff Help: Fix developer documentation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !11996
2026-05-04 10:32:28 -04:00
Matthew Woehlke
97d13c3053 Help: Improve diagnostics documentation
Make diagnostics into Sphinx objects so that they can be more readily
cross-referenced. (This is also needed to enable --help-diagnostic.)
Update various places that can make use of the same. Significantly
expand the documentation on controlling diagnostics.
2026-04-30 15:36:23 -04:00
Joseph Snyder
a7780d1b9c ctest: Add a CoverageTool setting to enable integration with llvm-cov
Add a `CTEST_TEST_COVERAGE_TOOL` variable to tell CTest to integrate
with `llvm-cov` source-based code coverage by setting the
`LLVM_PROFILE_FILE` environment variable for each test.

Issue: #26932
2026-04-30 14:22:26 -04:00
Brad King
a979d8eb3d Merge topic 'error_on_absolute_install_paths'
39a56136a3 Diagnostic: Add warn or error on absolute install paths
fd76089631 cmInstallFileSetGenerator: Only support per config Destination.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11882
2026-04-30 09:17:13 -04:00
Robert Maynard
39a56136a3 Diagnostic: Add warn or error on absolute install paths
Add `-Winstall-absolute-destination` diagnostic to warn or
error when an install command has an absolute destination.

This allow projects to enforce the best practice of not allowing
absolute install DESTINATIONS.
2026-04-29 09:22:29 -04:00
Roman Lavrov
b6367f723b Swift/Ninja: Emit modules separately from compilation
Add policy CMP0215 to emit `.swiftmodule` from a dedicated `-emit-module`
build edge for importable Swift targets in the Ninja generator.
Downstream targets can begin compiling as soon as the module interface
is ready, overlapping with upstream object compilation and linking.

When CMP0215 is NEW and CMP0157 is NEW, separate module emission is
enabled by default.  The `Swift_SEPARATE_MODULE_EMISSION` target
property (initialized by the `CMAKE_Swift_SEPARATE_MODULE_EMISSION`
variable) can override this per target.

The compile edge still passes `-emit-module` so that swiftc continues
to produce `.swiftdoc`; only the `.swiftmodule` output moves to the new
edge.

Also fix swiftmodule dependency edges in cmNinjaNormalTargetGenerator
to use IsLanguageUsed instead of GetLinkerLanguage, so C/C++ targets
whose linker language propagated to Swift do not produce spurious
implicit dependencies.

Closes: #27748
2026-04-24 15:58:18 -04:00
Marc Chevrier
e96c5ba13d Add the support of the wild linker
Fixes: #27755
2026-04-23 16:21:30 +02:00
Brad King
111454d8e0 Merge topic 'cmake-diagnostics-state'
99318e49b9 Help: Mention when diagnostics were added
daec98ba61 Diagnostics: Fix passing diagnostic state to try_compile
e0b0ac4295 Diagnostics: Overhaul warnings in cmake-gui
ca5d569524 Diagnostics: Switch state to new system
618c074a8c Diagnostics: Use categories for presets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11855
2026-04-15 10:29:06 -04:00
Matthew Woehlke
ca5d569524 Diagnostics: Switch state to new system
Add an additional state to the cmake instance to track diagnostics. Use
this to initialize any new/reset states we create so that other contexts
will inherit the diagnostic state from presets / command-line options.
Modify the front-end to map presets and -W command-line options to
manipulation of this new diagnostic state. Remove old members for
storing diagnostic state. Rework how diagnostic state is persisted.
Deprecate old, non-standard spellings for manipulating diagnostics.
Deprecate old 'dev' spelling for CMD_AUTHOR.

Note that this is a work in progress. Messaging has not yet been
updated, so the new state is not yet being used to control diagnostics,
and some of the logic to update the old state has been stripped (and
will eventually be removed entirely). Backward compatibility support for
the deprecated CMAKE_{WARN,ERROR}_DEPRECATED variables is only partially
implemented. The GUI's interface for manipulating warnings is partially
broken and needs to be overhauled. These tasks are being done in
separate commits in order to minimize review burden and keep the changes
per commit / per merge request more manageable.
2026-04-14 12:42:33 -04:00
Trung Nguyen
9a342eb39b Haiku: Add support for RESCAN
Haiku also uses the GNU toolchain and therefore should support this
feature.
2026-04-11 06:04:50 +10:00
Matthew Woehlke
46ede9b46d Help: Add preset role
Add a new CMake domain role for referencing fields in CMake presets.
This has two main purposes. First, it replaces generic references (which
were excessively long and required explicit titles) and acts as an
improved version of the `ref` role by allowing the always-present
`CMakePresets.` prefix to be elided. Second, unlike generic references
which silently degrade to broken links that are only caught by
`linkcheck`, broken references are flagged immediately in regular Sphinx
builds. Therefore, this both improves presentation by bringing line
lengths back under control, and reduces errors by making bad references
immediately detectable.

There is also a small change in rendering, as field references are now
rendered as literals. This is consistent with how fields are mentioned
in prose when they are not linked.
2026-04-08 12:14:41 -04:00
Matthew Woehlke
f26e9fcbae Help: Generate presets JSON schema, documentation
Replace the CMake presets schema.json with a YAML document, from which
both the JSON schema and (most of) the reST documentation are generated.
This achieves three main goals. First, the YAML document is much closer
to being human-readable than the JSON schema. Second, the JSON and reST
prose (when the latter differs) are contained in the same file, in most
cases adjacent (and at worst, still nearby) rather than in separate
files, which should greatly facilitate keeping the two in sync. Third,
changes are monumentally easier, as changes merely need to annotate the
version(s) to which variants apply, rather than creating entirely
separate schema trees for each variant.

Since requiring Python as part of the build process is not desired,
the outputs are kept in the source repository. This is consistent with
other areas which are seldom updated and require special tools, such as
the lexer.

While this does not represent any functional change for users, some
grammatical edits and other such editorial improvements have been made
in the process of transferring everything to the new YAML. However,
these are mainly incidental rather than representative of an attempt at
a thorough editorial pass.

Finally, for clarity, monkey-patch `sphing.domains.changesets` and add
additional 'version modified' directives with slightly tweaked text to
identify changes to the presets schema. These are nearly identical to
the built-in directives, but use the text 'in presets version N' rather
than 'in version N[.N]'.
2026-04-08 10:45:21 -04:00
Baudouin Feildel
313769e766 Rust: Add support for Rust editions with Rust_EDITION target property 2026-03-26 23:15:58 +01:00
Robert Maynard
accabeb272 install: Add option to use project name as default component
Teach `CMAKE_INSTALL_DEFAULT_COMPONENT_NAME` to accept a special
`<PROJECT_NAME>` placeholder.

Fixes: #27682
2026-03-17 10:33:44 -04:00
Brad King
eaecd6445b Merge topic 'import-std-experimental'
c1d58d3f3d Experimental: Restore `import std` gate
2e29354040 Experimental: Restore documentation link to CPS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !11745
2026-02-27 08:28:52 -05:00
Brad King
c1d58d3f3d Experimental: Restore import std gate
Several problems with this feature came up while testing 4.3.0-rc1.
These include both broken stdlib distributions and regressions in our
implementation of the feature since CMake 4.2.

Revert commit 70c1f0f43d (Experimental: Remove import std experimental
gate, 2026-02-04, v4.3.0-rc1~61^2) except for its incidental fixes.

Remove the 4.3 release notes related to `import std`.

Rotate the experimental gate's UUID.

Issue: #27426
Issue: #27597
Issue: #27626
Issue: #27635
2026-02-26 17:19:19 -05:00
Peter Kokot
45296cde2d Help: Transform CMAKE_SYSTEM_NAME tables into lists
Changes:
- Added some initial operating system family categories (Apple, UNIX,
  Windows).
- Used list instead of table. Unlike the tables, lists provide
  documenting additional info and CMake versions.
- Added CMake versions to most values where they were introduced or
  could be determined from the Git log.
- Additionally added the OHOS value to the list (introduced via #25987)
- Emscripten name was used by toolchain files also before CMake 4.2 but
  documented with this version.
2026-02-25 15:51:20 -05:00
Brad King
8705b0fa47 Merge topic 'patch-WindowsKernelModeDriver'
907f25fc64 CMAKE_SYSTEM_NAME: Mention WindowsKernelModeDriver

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11728
2026-02-24 14:25:07 -05:00
Brad King
fc34216180 Merge topic 'tweak-doc'
8b40c3642a Help: Tweak CMAKE_INSTALL_EXPORTS_AS_PACKAGE_INFO

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11727
2026-02-24 14:22:07 -05:00
Peter Kokot
907f25fc64 CMAKE_SYSTEM_NAME: Mention WindowsKernelModeDriver
This value can be used as of CMake 4.1 without experimental gate.
2026-02-24 18:39:37 +01:00
Matthew Woehlke
8b40c3642a Help: Tweak CMAKE_INSTALL_EXPORTS_AS_PACKAGE_INFO
The format example for CMAKE_INSTALL_EXPORTS_AS_PACKAGE_INFO is quite
long and, in its prior state, was likely to force a line wrap before it,
which could lead to non-optimal spacing of the preceding line. As there
is no easy way to break in the middle of the example, instead break it
out into a separate element.
2026-02-24 12:25:24 -05:00
Peter Kokot
60b8e6d33f CMAKE_SYSTEM_NAME: Mention HP-UX as discontinued system 2026-02-23 19:05:18 +01:00
Brad King
84aff9588f Merge topic 'remove-cps-experimental-gate'
f5c515cbf2 CPS: Remove experimental gate (mostly)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11683
2026-02-13 09:51:24 -05:00
Matthew Woehlke
f5c515cbf2 CPS: Remove experimental gate (mostly)
Remove basic CPS import and export from 'experimental' status. Update
documentation and tests accordingly.

Note that mapped exports (CMAKE_EXPERIMENTAL_MAPPED_PACKAGE_INFO) are
still experimental.
2026-02-11 16:10:29 -05:00
Brad King
0aa7e258d4 Merge topic 'doc-ctest-link'
01a47a790b Help: Link `CTEST_*` variables to dashboard client
12a0ebe96a Help/CTest: Improve formatting and grammar

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11677
2026-02-11 12:05:29 -05:00
Tyler Yankee
01a47a790b Help: Link CTEST_* variables to dashboard client 2026-02-10 09:59:45 -05:00
Vito Gamberini
70c1f0f43d Experimental: Remove import std experimental gate
Fixes: #27571
2026-02-07 09:03:43 -05:00
Tyler Yankee
98f9874703 cmake: Add per-language link flags for all target types
Previously, `CMAKE_<LANG>_LINK_FLAGS` was an undocumented variable used
for linking executables only. Re-spell that variable mirroring the
existing spellings for shared and module libraries, and add policy
CMP0210 to preserve compatibility.

Then, repurpose `CMAKE_<LANG>_LINK_FLAGS` to provide a variable to be
used for per-language link flags for all target types, along with a
per-configuration variant. These are added to the `<LINK_FLAGS>` rule
placeholder in the generators.

Fixes: #21934
Relates: #25620

Co-authored-by: Brad King <brad.king@kitware.com>
2026-01-31 19:37:09 -05:00
Tyler Yankee
7b4b556e2d Help: Fix description of CMAKE_*_LINKER_FLAGS variables
Improve the wording on the behavior of the per-configuration variants
of `CMAKE_*_LINKER_FLAGS`. In particular, note that these variables
only apply to the specified build configuration, and replace the
ambiguous reference to `CMAKE_C_FLAGS_*` with a precise description.

Clarify that the "default" variants of these variables apply for all
build configurations.

Add links between pages for the default and per-configuration variables.
2026-01-29 15:30:57 -05:00
Paulius Velesko
47c3e55d4a HIP: Add support for SPIR-V platform
Add `spirv` as a known value for `CMAKE_HIP_PLATFORM`.
Default `CMAKE_HIP_ARCHITECTURES` to `OFF` for `spirv`.

Fixes: #27410
2026-01-20 13:18:18 -05:00
Brad King
59c3422974 Merge topic 'pvs-analyze'
ef12ef1bd6 pvs-studio: Add support for linting with PVS-Studio
8f722e0fac cmList: Expose container reserve
5d1f269658 cmcmd: Allow passing object file to co_compile commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Overchenko <aleksandr9809@gmail.com>
Merge-request: !11323
2026-01-19 09:30:58 -05:00
Martin Duffy
ef12ef1bd6 pvs-studio: Add support for linting with PVS-Studio 2026-01-16 11:25:59 -05:00
Craig Scott
b61637f90f File sets: Add verification of private file sets
Add support for PRIVATE header sets, analogous to the existing
INTERFACE header sets support. A key difference between the two is
the way they handle build and usage requirements. INTERFACE
header sets rely on the original target's INTERFACE, whereas PRIVATE
header sets copy across various properties from the original target.

Generated files need special handling for PRIVATE header sets.
Add a dependency on the original target to the verification target to
ensure such generated files will exist.

Fixes: #23448
2026-01-16 18:10:17 +11:00
Craig Scott
75cde06c37 Merge topic 'doc-cleanup-4.2'
a7fc57ed1c Help: Restore correct sort order for property and variable manuals
e73307957e Help: Fix minor grammar problems

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11546
2025-12-23 19:27:32 -05:00
Craig Scott
e73307957e Help: Fix minor grammar problems 2025-12-21 20:51:52 +11:00
Brad King
8afe7a3d2d Merge topic 'emscripten-arch-id'
5ec87b2ba7 Emscripten: Provide CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11452
2025-11-26 10:02:26 -05:00
Brad King
5ec87b2ba7 Emscripten: Provide CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID
Extend commit 96d9b94a98 (Emscripten: Add platform modules, 2025-05-16,
v4.2.0-rc1~607^2~3) to account for commit 7f0f382c55 (Provide
CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID on more compilers, 2025-03-24,
v4.1.0-rc1~499^2).

Fixes: #27425
2025-11-25 15:46:16 -05:00
Brad King
daeca36fe5 Merge topic 'autogen-tgt-intdir-strategy-docs'
7d871d7857 Help/CMAKE_AUTOGEN_INTERMEDIATE_DIR_STRATEGY: document supported generators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11429
2025-11-19 08:48:31 -05:00
Ben Boeckel
7d871d7857 Help/CMAKE_AUTOGEN_INTERMEDIATE_DIR_STRATEGY: document supported generators
Fixes: #27388
2025-11-18 16:28:11 -05:00
Brad King
515bb02443 Merge topic 'package-info-from-install-export'
34343922a5 install: Add ability to generate CPS from install(EXPORT)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11315
2025-11-12 11:53:07 -05:00
Matthew Woehlke
34343922a5 install: Add ability to generate CPS from install(EXPORT)
Add the ability to generate CPS package information when install(EXPORT)
is used. This relies on additional information to be passed to CMake,
and is intended as a way of getting CPS out of existing projects without
needing to make changes to the projects' CMakeLists.txt. (Particularly,
this feature is intended for package distributors, not project authors.)
2025-11-11 11:51:58 -05:00
Peter Kokot
35b1250b0a GNUInstallDirs: Add notice about --prefix option
When setting the installation prefix at the installation phase
(`cmake --install`) using the `--prefix` option, the GNU special cases
aren't applicable. This also adds a small clarification when to use the
`--prefix` option at the installation phase.

Briefly mentioned also the CMake presets installDir field,
the CPACK_PACKAGING_INSTALL_PREFIX variable, and the $<INSTALL_PREFIX>
generator expression so user has a better overview.

Fixes #27343
Fixes #26338
2025-11-10 22:44:12 +01:00
Clinton Stimpson
5a18728cec CPack/Archive: Add support for setting UID/GID in archive
Add `CPACK_ARCHIVE_UID` and `CPACK_ARCHIVE_GID` options.

Add a policy to change the default to 0/0 to enable ownership
by root if unpacking as root.

Fixes: #12901
2025-11-08 09:25:08 -05:00
Peter Kokot
33d9146472 CMAKE_ENABLE_EXPORTS: Deprecate variable
This makes it more clear which variable should be used.

Fixes #27357
2025-11-04 20:07:39 +01:00
Brad King
8986b8b7ae Merge topic 'xcode-macos-deployment-target'
de53a46a91 Help: Add 4.1 release note for restored Xcode default deployment target
85ba6f5d1b Merge branch 'backport-4.0-xcode-macos-deployment-target'
884260ced6 Help: Add 4.0 release note for restored Xcode default deployment target
1a37c83c7e Xcode: Restore default CMAKE_OSX_DEPLOYMENT_TARGET to run on host
e927408047 Apple: Initialize deployment target after SDK

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11361
2025-10-27 09:26:18 -04:00
Brad King
b39e361175 Merge topic 'xcode-macos-deployment-target' into release-4.2
de53a46a91 Help: Add 4.1 release note for restored Xcode default deployment target
85ba6f5d1b Merge branch 'backport-4.0-xcode-macos-deployment-target'
884260ced6 Help: Add 4.0 release note for restored Xcode default deployment target
1a37c83c7e Xcode: Restore default CMAKE_OSX_DEPLOYMENT_TARGET to run on host
e927408047 Apple: Initialize deployment target after SDK

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11361
2025-10-27 09:26:15 -04:00
Brad King
85ba6f5d1b Merge branch 'backport-4.0-xcode-macos-deployment-target' 2025-10-26 11:19:58 -04:00
Brad King
1a37c83c7e Xcode: Restore default CMAKE_OSX_DEPLOYMENT_TARGET to run on host
Xcode by default targets the SDK's macOS version rather than the host's
macOS version.  In commit 7b19531291 (macOS: Do not pass any
SDK/-isysroot to compilers by default, 2024-11-06, v4.0.0-rc1~511^2) we
reverted commit 24aafbde11 (Xcode: Adjust deployment target SDK version
to host version, 2015-10-11, v3.4.0-rc2~6^2), but it is still needed for
Xcode.  Restore the behavior so binaries run on the host by default.

Fixes: #27309
2025-10-26 11:19:19 -04:00
Eduard Voronkin
31b51340a1 FASTbuild: allow setting custom IDE args
Allow users to set custom args
when FBuild is invoked via IDE.
2025-10-17 10:16:14 -04:00
Brad King
706bf669e1 Merge topic 'doc-apple-arch-default' into release-4.2
6055a12d36 Help: Document default architecture when CMAKE_OSX_ARCHITECTURES is not set

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: rumgot rumgotov <rumgot@gmail.com>
Merge-request: !11296
2025-10-10 10:19:10 -04:00