Commit Graph

72639 Commits

Author SHA1 Message Date
Brad King 72ce711899 GoogleTest: Avoid POST_BUILD race condition for gtest_discover_tests()
Fix commit 6680df042e (GoogleTest: Avoid POST_BUILD race condition for
gtest_discover_tests(), 2025-10-26, v4.2.0-rc2~15^2) to actually hash
the target name instead of an empty string.

Fixes: #27319
2025-11-06 14:28:30 -05:00
Brad King 38095c2da5 Merge topic 'fix-cps-crash-on-bad-input' into release-4.2
fa4bed7844 cmPackageInfoReader: Don't crash if input is malformed
be99a82eee cmPackageInfoReader: Just use std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11390
2025-11-06 13:26:10 -05:00
Brad King 6b03947c2c Merge topic 'improve-cps-find_package-failure-reporting' into release-4.2
6c2fc502b6 find_package: Report why a candidate was rejected

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11377
2025-11-06 13:24:36 -05:00
Matthew Woehlke fa4bed7844 cmPackageInfoReader: Don't crash if input is malformed
Check all instances of converting a JSON value to a string to ensure
that we check first if the value is convertible, in order to avoid an
exception being thrown, which crashes CMake. Modify some instances to
report when we encounter such invalid values. (Many instances, however,
just silently ignore invalid values.)

Fixes: #27350
2025-11-05 11:29:13 -05:00
Matthew Woehlke be99a82eee cmPackageInfoReader: Just use std::string
Change cmPackageInfoReader::SetMetaProperty to just take the property
name as a std::string. We end up constructing one when we call
cmTarget::SetProperty, so we might as well do it up front and be done
with it. (Before, we were converting a string_view to char*, which is
decidedly non-optimal.)
2025-11-05 10:46:09 -05:00
Matthew Woehlke 6c2fc502b6 find_package: Report why a candidate was rejected
Improve how find_package reports the list of candidate package
configuration files that were considered but rejected to include a
reason for rejection. For CPS in particular, this allows the user to
tell if a CPS file was rejected due to a version mismatch, missing
required components, or because the file could not be read.

While we do not try to report more detail for why cmPackageInfoReader
rejected a file, the possible reasons are usually easy enough to
distinguish:

- The file is so malformed that we cannot read a JSON object.
- The schema version is not a version that CMake understands.
- The root object does not contain a string named "name".
- The root object does not contain an object named "components".
- Prefix resolution failed.

Three of these can only result from a file that fails schema validation.
2025-11-05 10:45:23 -05:00
Brad King 6ece8dee79 Merge topic 'improve-codespell' into release-4.2
7cc114601a codespell: Prune ignore list
d197474083 codespell: Ignore test output regexes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11388
2025-11-04 13:33:49 -05:00
Matthew Woehlke 7cc114601a codespell: Prune ignore list
Remove entries from the codespell ignore list that do not seem to be
present any more. Also, remove a deliberate typo and instead add a local
annotation to ignore it.

This list is still uncomfortably long, but unfortunately current
versions of codespell do not offer any granularity in between annotating
individual uses (which is not practical in most cases) or globally
ignoring words (which is overly broad and risks missing real errors).
2025-11-04 13:13:09 -05:00
Matthew Woehlke d197474083 codespell: Ignore test output regexes
Ignore RunCMake output regexes (i.e. *-stdout.txt, *-stderr.txt) when
checking spelling. Because these are regular expressions, they have a
higher likelihood of having false positives, and because they are
expected output, any text they contain ought to also appear in whatever
code generates it (or else, is probably text that depends on user input
and shouldn't be spell-checked anyway).
2025-11-04 13:12:56 -05:00
Brad King 519d69c92c Merge topic 'typos-1.39.0' into release-4.2
1405dc49e8 pre-commit: version bump `typos` and `sphinx-lint` hooks + fix found typos

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11380
2025-11-04 11:24:30 -05:00
Brad King 64f5c4d307 Merge topic 'fbuild_fix_superfluous_dirs' into release-4.2
2a5855f034 FASTBuild: fix superfluous directory creation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11379
2025-11-04 10:47:06 -05:00
Alex Turbov 1405dc49e8 pre-commit: version bump typos and sphinx-lint hooks + fix found typos 2025-11-03 10:18:16 -05:00
Eduard Voronkin 2a5855f034 FASTBuild: fix superfluous directory creation
Fixes: #27356
2025-11-03 09:39:16 -05:00
Brad King e8863b5a74 Merge topic 'ci-fedora-43' into release-4.2
2338d987d5 ci: use Fedora 43 images and environments
5219f383fe ci: update Fedora base images to Fedora 43
373e8ea652 clang-tidy: ignore warnings new in version 21
e12ce158bc clang-tidy: fix bugprone-unintended-char-ostream-output lint
2ca11db2e3 pre-commit: version bump `typos` hook plus fix found typos
d314d85ea5 Tests: Extend RunCMake.ParseImplicitLinkInfo for LLVMFlang 21.1.3
b7ad081f1a Tests: Fix RunCMake.CXXModules compilation with Clang 21

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11375
2025-10-31 07:12:26 -04:00
Brad King 2338d987d5 ci: use Fedora 43 images and environments 2025-10-30 17:46:06 -04:00
Brad King 5219f383fe ci: update Fedora base images to Fedora 43
Also update to typos 1.38.1.
2025-10-30 17:43:17 -04:00
Brad King 373e8ea652 clang-tidy: ignore warnings new in version 21
These warnings can be fixed in the future.  Ignore them for now.
2025-10-30 17:43:17 -04:00
Brad King e12ce158bc clang-tidy: fix bugprone-unintended-char-ostream-output lint 2025-10-30 17:43:17 -04:00
Alex Turbov 2ca11db2e3 pre-commit: version bump typos hook plus fix found typos
Backport commit 8de02a14c8 (ci(pre-commit): version bump `typos` hook
plus fix found typos, 2025-10-23) to the CMake 4.2 release branch.
2025-10-30 17:43:16 -04:00
Brad King d314d85ea5 Tests: Extend RunCMake.ParseImplicitLinkInfo for LLVMFlang 21.1.3 2025-10-30 17:43:16 -04:00
Brad King b7ad081f1a Tests: Fix RunCMake.CXXModules compilation with Clang 21
Clang 21 now enforces placement of the module declaration:

    .../scan_properties/module.cxx:7:8: error: module
       declaration must occur at the start of the translation unit
2025-10-30 17:40:02 -04:00
Brad King a86b6c4db4 CMake 4.2.0-rc2 v4.2.0-rc2 2025-10-30 09:03:07 -04:00
Brad King c727d96b40 Merge topic 'fbuild_compdb' into release-4.2
5e25ee691a FASTBuild: generate compile_commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11373
2025-10-30 08:57:58 -04:00
Brad King 28873cce5e Merge topic 'macos-no-per-arch-sysroot' into release-4.2
1925477cb7 macOS: Do not incorrectly search for per-arch SDKs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11372
2025-10-30 08:54:32 -04:00
Brad King db190bbe49 Merge topic 'tutorial-step-0' into release-4.2
fb58de1a56 Tutorial: Add Step 0 to prepare the working environment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11367
2025-10-30 08:51:12 -04:00
Brad King fb85cb7716 Merge topic 'vs-sln' into release-4.2
6ebf21a360 VS: Restore support for Intel Fortran projects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11371
2025-10-30 08:49:05 -04:00
Eduard Voronkin 5e25ee691a FASTBuild: generate compile_commands
If `CMAKE_EXPORT_COMPILE_COMMANDS` is set use FASTBuild's `-compdb`
option in order to generate `compile_commands.json` file.

Fixes: #27345
2025-10-29 15:53:07 -04:00
Brad King 1925477cb7 macOS: Do not incorrectly search for per-arch SDKs
Extend commit a9b41195d2 (Handle multi-arch sysroots on Apple platforms,
2019-07-26, v3.17.0-rc1~287^2) to recognize versioned macOS SDK names.

Fixes: #27340
2025-10-29 14:50:51 -04:00
Brad King 6ebf21a360 VS: Restore support for Intel Fortran projects
Refactoring in commit 3882718872 (VS: Decouple solution generation from
`.sln` file format, 2025-09-15, v4.2.0-rc1~154^2~3) accidentally dropped
Fortran targets from the generated VS Solution.

Fixes: #27346
2025-10-29 11:55:53 -04:00
Vito Gamberini fb58de1a56 Tutorial: Add Step 0 to prepare the working environment
Adds a "Step 0" to the tutorial which discusses minutia about where to
get CMake, how to run it, and most importantly deals at length with
various generator issues which aren't covered elsewhere.
2025-10-29 09:49:23 -04:00
Brad King d98c9bf2cc Merge branch 'release-4.1' into release-4.2 2025-10-29 09:32:25 -04:00
Brad King b22a77e337 Merge topic 'doc-cmake.org-tutorial-archive' into release-4.2
5473a45fd8 Tutorial: Restore source archive when published on cmake.org

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11370
2025-10-29 09:31:10 -04:00
Brad King 61841b7ee4 Merge topic 'doc-cmake.org-tutorial-archive' into release-4.1
5473a45fd8 Tutorial: Restore source archive when published on cmake.org

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11370
2025-10-29 09:29:14 -04:00
Brad King 5473a45fd8 Tutorial: Restore source archive when published on cmake.org
Restore commit 4cb616fed6 (Tutorial: Provide a source archive when
published on cmake.org, 2022-04-27, v3.23.2~22^2).  Its effects were
accidentally reverted by commit 9784834b4c (Help: Use `*.rst` extension
for included files, 2025-04-07, v4.1.0-rc1~354^2).

Reported-by: Vito Gamberini <vito.gamberini@kitware.com>
2025-10-29 09:17:14 -04:00
Brad King 37d7b9820e Merge topic 'FASTBuild-optimize-try_compile' into release-4.2
f6abf8044a FASTBuild: Disable caching and distribution in try_compile builds

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11365
2025-10-28 09:40:34 -04:00
Brad King aef339b26f Merge topic 'instrumentation-exit' into release-4.2
236207b81a instrumentation: Fix snippet `result` field
d3add47973 Tests/Instrumentation: Remove unused files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11339
2025-10-28 09:38:49 -04:00
Brad King d2800671d9 Merge topic 'make-LINK_OPTIONS-position' into release-4.2
8fa4a4bf67 Makefiles: Position target-wide link flags consistently with other generators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11355
2025-10-28 09:36:27 -04:00
Brad King 3ef5ce55db Merge topic 'python_debug_postifx_no_interpreter' into release-4.2
6a35c277d0 FindPython: Support getting DEBUG_POSTFIX without requiring Interpreter
43fec72adb Tests: Fix RunCMake.UseSWIG SetPOSTFIX case on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11345
2025-10-28 09:34:29 -04:00
Brad King b5ec664401 Merge topic 'project-license-doc' into release-4.2
ebf0a359ad Help: Improve documentation of project SPDX_LICENSE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11348
2025-10-28 09:32:37 -04:00
Brad King 5ed5a1208e Merge branch 'release-4.1' into release-4.2 2025-10-28 09:29:35 -04:00
Brad King 9d7393a0b0 Merge topic 'improve-cps-project-error' into release-4.2
f2b7184b98 cmPackageInfoArguments: Improve error message

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !11363
2025-10-28 09:28:11 -04:00
Brad King 7532e25dc9 Merge topic 'improve-cps-export-namespace-error' into release-4.2
68e836d20b Merge branch 'backport-4.1-improve-cps-export-namespace-error'
86e647ef2a CPS: Improve invalid namespace error

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11364
2025-10-28 09:22:32 -04:00
Brad King 66095fd31d Merge topic 'improve-cps-project-error' into release-4.1
f2b7184b98 cmPackageInfoArguments: Improve error message

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11363
2025-10-28 09:17:37 -04:00
Brad King 48908f04f6 Merge topic 'improve-cps-export-namespace-error' into release-4.1
86e647ef2a CPS: Improve invalid namespace error

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11364
2025-10-28 09:16:36 -04:00
Eduard Voronkin f6abf8044a FASTBuild: Disable caching and distribution in try_compile builds
This avoids hashing the whole toolchain and makes `try_compile` faster.
2025-10-27 16:59:29 -04:00
Brad King 68e836d20b Merge branch 'backport-4.1-improve-cps-export-namespace-error' 2025-10-27 15:56:11 -04:00
Tyler Yankee 236207b81a instrumentation: Fix snippet result field
Give the actual exit code of the command from the snippet as intended;
currently, this always gives 0 for sub-commands like compile and link,
as well as `ctest`.

For now, the result in build snippets will be `null`.
2025-10-27 15:42:58 -04:00
Matthew Woehlke 86e647ef2a CPS: Improve invalid namespace error
When CPS export fails due to a dependency on an improperly named
external target, reiterate the "canonical namespace" in the error
message for clarity.
2025-10-27 14:40:34 -04:00
Matthew Woehlke f2b7184b98 cmPackageInfoArguments: Improve error message
When given the name of a project that doesn't exist, report it as an
"unknown project" rather than an "invalid project". This is more
consistent with other, similar reporting.
2025-10-27 12:29:40 -04:00
Marc Chevrier 8fa4a4bf67 Makefiles: Position target-wide link flags consistently with other generators
In particular, the `LINK_OPTIONS` target property was not placed
on link lines consistently with other generators.

Fixes: #27326
2025-10-27 10:41:47 -04:00