Commit Graph

12331 Commits

Author SHA1 Message Date
Brad King 3f8ad3e894 Tests: Simplify implementation of execute_process encoding test executable
Replace use of KWSys ConsoleBuf with direct encoding conversion calls.
2025-04-17 19:53:45 -04:00
Brad King 407363abd0 Merge topic 'argument-parser-trailing-positionals'
df870e17f5 cmArgumentParser: Implement trailing positional args

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10655
2025-04-17 10:09:34 -04:00
Brad King e78cf73b52 Merge topic 'makefile-progress'
5781cf406f Makefile: Fix progress with non-excluded targets in excluded dirs
89ab14b05b cmGlobalGenerator: Constify IsExcluded use of cmLocalGenerator
0aabf32590 cmGeneratorExpression: Constify use of cmLocalGenerator
88f54fba43 cmLocalGenerator: Avoid unnecessary const-ness propagation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10658
2025-04-17 10:00:51 -04:00
Brad King 3cc9b88eba Merge topic 'fileapi-reply-on-failure'
0cc962665b fileapi: Generate partial reply when buildsystem generation fails
09aa968ed0 cmFileAPI: Add BuildReplyEntry wrapper around AddReplyIndexObject
5e0a644ee8 Tests/RunCMake/FileAPI: Explicitly specify expected reply index prefix
0a0bd69f4b Help: Polish cmake-file-api(7) manual

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10652
2025-04-17 09:59:20 -04:00
Vito Gamberini df870e17f5 cmArgumentParser: Implement trailing positional args 2025-04-16 14:15:48 -04:00
Brad King 74c62a180d Merge topic 'empty_elseif_warning'
2a8bc1c4aa if: Add warning when elseif has no argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Merge-request: !10643
2025-04-16 09:40:23 -04:00
Brad King 9d1a0fa256 Merge topic 'normalize-input-paths'
cd4e72ca08 Normalize PWD environment variable before using it

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10659
2025-04-16 09:37:09 -04:00
xndcn 5781cf406f Makefile: Fix progress with non-excluded targets in excluded dirs
Fixes: #26871
2025-04-16 09:04:17 -04:00
Aliochat 2a8bc1c4aa if: Add warning when elseif has no argument
Resolves: #26442
2025-04-15 10:58:25 -04:00
Brad King 23bc326b81 Merge topic 'diab-asm-test'
e6e5ab6d00 Tests/RunCMake/Diab: Explicitly specify ASM compiler for asm test

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10647
2025-04-15 09:40:45 -04:00
Brad King cd4e72ca08 Normalize PWD environment variable before using it
In commit 5aed3ee49d (cmSystemTools: Add GetLogicalWorkingDirectory,
2024-10-28, v4.0.0-rc1~528^2~6) we incorrectly trusted `PWD` to be a
normalized path so long as its realpath matches the current working
directory.

Fixes: #26870
2025-04-15 09:37:08 -04:00
Brad King 6c35c9ea22 Merge topic 'LINKER_FLAGS-CMP0181-OLD'
2e9648e0de Ninja generator: restore correct encoding for policy CMP0181=OLD

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10645
2025-04-15 09:36:40 -04:00
Brad King 0cc962665b fileapi: Generate partial reply when buildsystem generation fails
In particular, the `configureLog` reply is useful for IDEs to read
`CMakeFiles/CMakeConfigureLog.yaml` when configuration fails.

Fixes: #26621
2025-04-14 10:42:03 -04:00
Brad King 5e0a644ee8 Tests/RunCMake/FileAPI: Explicitly specify expected reply index prefix 2025-04-14 09:34:22 -04:00
Sanjiv Gupta e6e5ab6d00 Tests/RunCMake/Diab: Explicitly specify ASM compiler for asm test
Do not depend on detection of ASM compiler to run the asm test.
Specify `CMAKE_ASM_COMPILER` explicitly.

Fixes: #26864
2025-04-14 08:52:34 -04:00
Brad King ee24bb6a6f Merge topic 'cmake-parent-list-file'
a9ea55f0d7 Fix CMAKE_PARENT_LIST_FILE after return from include() or find_package()
41708398eb cmMakefile: Factor out base class for list file scope RAII
ce8be3da80 cmMakefile: De-duplicate CMAKE_CURRENT_LIST_FILE variable names
0b85f8f137 Tests: Add cases for CMAKE_PARENT_LIST_FILE with include() and find_package()
002979e145 Tests/RunCMake/include: Match incidental line numbers more robustly

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10505
2025-04-14 08:29:52 -04:00
Brad King bc1c3e94e0 Merge topic 'cps-link-only'
ebe487ea81 export: Allow export with LINK_ONLY library dependencies
13c7bb5b0c cmGeneratorExpression: Update strip function to collect parsed expressions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10522
2025-04-14 08:25:55 -04:00
Marc Chevrier 2e9648e0de Ninja generator: restore correct encoding for policy CMP0181=OLD
Fixes: #26857
2025-04-12 16:37:57 +02:00
Benjamin Buch a9ea55f0d7 Fix CMAKE_PARENT_LIST_FILE after return from include() or find_package()
Fix the implementation, clarify the documentation, and add tests.

Fixes: #25026
Co-authored-by: Brad King <brad.king@kitware.com>
2025-04-12 09:40:37 -04:00
Benjamin Buch 0b85f8f137 Tests: Add cases for CMAKE_PARENT_LIST_FILE with include() and find_package()
Issue: #25026
Co-authored-by: Brad King <brad.king@kitware.com>
2025-04-12 09:38:12 -04:00
Brad King 002979e145 Tests/RunCMake/include: Match incidental line numbers more robustly 2025-04-12 09:20:00 -04:00
Martin Duffy ebe487ea81 export: Allow export with LINK_ONLY library dependencies 2025-04-11 13:20:14 -04:00
Brad King 8532e28528 Tests/HIP: Drop unnecessary hard-coded compute architectures
In commit 8514ee9b31 (HIP: analyze output of `hipcc` to determine
default GPU architecture, 2021-05-27, v3.21.0-rc1~66^2) we dropped these
from most tests, but missed `HIP.TryCompile`.  Since commit 735f41fc2d
(HIP: Use 'rocm_agent_enumerator' to determine CMAKE_HIP_ARCHITECTURES,
2021-09-15, v3.21.3~1^2~3) we automatically select architectures anyway.
2025-04-10 14:43:22 -04:00
Brad King cc2d986fdf Merge topic 'GNUInstallDirs-special-cases'
4ed399ccfb GNUInstallDirs: Change special path defaults to absolute
7566a477f7 GNUInstallDirs: Factor out helper for special absolute path logic
42dfcbf1a5 GNUInstallDirs: Refactor LIBDIR default calculation
9789f7d05e GNUInstallDirs: Add internal helper to compute specific defaults
83f44bbf53 GNUInstallDirs: Factor out helper to compute system type
0c9b6aa9e4 GNUInstallDirs: De-duplicate description of defaults
18e1341950 GNUInstallDirs: Move defaults from arguments to variables
9f41a67fce GNUInstallDirs: Reduce duplication of CMAKE_INSTALL_ prefix
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10542
2025-04-10 08:57:49 -04:00
Brad King b309159930 Merge topic 'iar-add-icstat-support'
c7d2a17253 IAR: Add support for C-STAT static analysis

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10624
2025-04-10 08:40:28 -04:00
Brad King 6e101d7544 Merge topic 'hip-test-diagnostics'
c7ae9400c9 Tests/HIP: Improve diagnostics on failure
37089ffe20 Tests/HIP: Improve cmake code formatting
b8dd3b208a clang-format: Apply formatting to HIP sources with .hip extension

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10633
2025-04-10 08:30:07 -04:00
Brad King 180fc85666 Merge topic 'FindXCTest-xcode-16'
2e59cee922 FindXCTest: Fix test module generation for Xcode 16
c653c1aa47 FindXCTest: Pass -bundle_loader linker flag for test module more reliably

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10573
2025-04-10 08:27:40 -04:00
Brad King 3c08fa2b0d Merge topic 'FindXCTest-xcode-16' into release-4.0
2e59cee922 FindXCTest: Fix test module generation for Xcode 16
c653c1aa47 FindXCTest: Pass -bundle_loader linker flag for test module more reliably

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10573
2025-04-10 08:27:38 -04:00
Brad King 2e59cee922 FindXCTest: Fix test module generation for Xcode 16
In Xcode 7.3 and above, the `TEST_HOST` setting causes Xcode to
implicitly place the test module inside the executable bundle regardless
of the module's own location settings.  Since commit a364d2513a (Xcode:
Fixup XCTest bundle location for Xcode 7.3, 2016-03-25, v3.5.2~6^2) we
explicitly tell CMake to put the test module in the same location so
that generator expressions used by `xctest_add_test` agree with where
Xcode actually puts it.  In Xcode 16 and above, our explicit location
settings for the test module conflict with Xcode's `TEST_HOST` rules,
causing errors about multiple commands producing the same path.

Fix this by dropping CMake's explicit location for the test module
unless needed to match a project-specified location for the testee.
Instead, teach `xctest_add_test` to express the xctest module location
selected by `TEST_HOST` by using generator expressions referencing the
testee bundle.

Fixes: #26301
Fixes: #26514
2025-04-09 17:06:13 -04:00
Brad King c7ae9400c9 Tests/HIP: Improve diagnostics on failure 2025-04-09 13:32:36 -04:00
Brad King 37089ffe20 Tests/HIP: Improve cmake code formatting 2025-04-09 13:31:42 -04:00
Brad King b8dd3b208a clang-format: Apply formatting to HIP sources with .hip extension 2025-04-09 13:31:38 -04:00
Felipe Torrezan c7d2a17253 IAR: Add support for C-STAT static analysis
The IAR platform offers an integrated static analysis tool named
IAR C-STAT.

Closes: #26844
2025-04-09 12:01:02 -04:00
Cristian Le 4ed399ccfb GNUInstallDirs: Change special path defaults to absolute
Add policy `CMP0192` for compatibility.

Closes: #25852
Signed-off-by: Cristian Le <git@lecris.dev>
2025-04-09 11:31:43 -04:00
Brad King e6103a2c66 Merge topic 'patch-FindPatch'
a01b092e19 FindPatch: Update documentation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10610
2025-04-08 10:30:13 -04:00
Peter Kokot 44b53f8481 FindOpenSSL: Update documentation
- Added examples section.
- Synced module descriptions a bit with other find modules.
- OpenSSL_FOUND variable used. The OPENSSL_FOUND is also set by the
  find_package_handle_standard_args() to the same value.
- Described the applink interface a bit further.
2025-04-08 00:30:41 +02:00
Peter Kokot a01b092e19 FindPatch: Update documentation
- Extended the examples section.
- Module documentation synced with other find modules a bit.
- Patch_FOUND variable used. The PATCH_FOUND is also set by the
  find_package_handle_standard_args().
2025-04-06 23:04:04 +02:00
Cristian Le 42dfcbf1a5 GNUInstallDirs: Refactor LIBDIR default calculation
Implement via the `_GNUInstallDirs_<dir>_get_default` helper.

Signed-off-by: Cristian Le <git@lecris.dev>
2025-04-04 12:17:39 -04:00
Brad King 9856550232 Merge topic 'improve-cps-multiple-inclusion'
de5fa2ae53 find_package: Improve support for CPS multiple inclusion

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10586
2025-04-04 08:38:31 -04:00
Brad King 1a87a23ca3 Merge topic 'test-tolerate-env-Werror'
2f9211b4e4 Tests: Isolate RunCMake.LinkWarningAsError from -Werror flags in environment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10587
2025-04-04 08:24:32 -04:00
Brad King 2f9211b4e4 Tests: Isolate RunCMake.LinkWarningAsError from -Werror flags in environment
Fixes: #26836
2025-04-03 15:12:26 -04:00
Matthew Woehlke de5fa2ae53 find_package: Improve support for CPS multiple inclusion
Keep track of CPS files we have imported in CMake's state, and use this
(instead of the prior, temporary work-around that used `<name>_CONFIG`)
as a guard for trying to import more than once from the same file. This
has two advantages; first, it is robust against finding the same package
name in different locations in alternating searches, and second, it
allows us to load additional appendices associated with a root package
that has already been loaded.

Fixes: #26731
2025-04-03 14:40:39 -04:00
Brad King be1f4dde2e Merge topic 'find_package-cps-multiple-inclusion'
b498611902 find_package: Add minimal support for CPS multiple inclusion

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10581
2025-04-03 14:06:53 -04:00
Brad King 3e4519a4e3 Merge topic 'find_package-cps-multiple-inclusion' into release-4.0
b498611902 find_package: Add minimal support for CPS multiple inclusion

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10581
2025-04-03 14:06:51 -04:00
Brad King 07970d3c64 Merge topic 'restore-home-tidle'
01f92efeb0 Restore expansion of leading '~' as home directory in input paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10580
2025-04-03 14:04:57 -04:00
Brad King 01f92efeb0 Restore expansion of leading '~' as home directory in input paths
This was accidentally dropped by commit 622596c6b2 (cmSystemTools:
Re-implement ToNormalizedPathOnDisk without translation map, 2024-10-30,
v4.0.0-rc1~528^2~5).  Previously it was done by `CollapseFullPath`.
`cm::PathResolver` intentionally does not expand `~` because it makes
sense only for transforming input paths.  Teach `ToNormalizedPathOnDisk`
to handle it directly.

Fixes: #26827
2025-04-02 14:41:48 -04:00
Matthew Woehlke b498611902 find_package: Add minimal support for CPS multiple inclusion
Do not try to load a CPS file if we've already loaded the same file.
This only works if the current `find_package` call selects the same file
as the previous most recent call, and if the user has not meddled with
the `<name>_CONFIG` variable.

Issue: #26731
2025-04-02 13:45:36 -04:00
Brad King ff5712fbfc Merge topic 'find_package-fix-nested-calls'
37823b366f find_package: Restore component requirements in nested calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10576
2025-04-02 10:23:28 -04:00
Brad King 7167236ba3 Merge topic 'find_package-fix-nested-calls' into release-4.0
37823b366f find_package: Restore component requirements in nested calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10576
2025-04-02 10:23:27 -04:00
Matthew Woehlke 37823b366f find_package: Restore component requirements in nested calls
Fix logic to populate required and optional components from CMake
variables when `find_package` is called in a nested context.

This was broken in commit e2a6416622 (find_package: Refactor in support
of recursion, 2024-11-29, v4.0.0-rc1~356^2), which promoted the
component sets from locals (in cmFindPackageCommand::InitialPass) to
member variables. Previously, in a nested context, these sets were
simply not filled, and we relied on the variables indicating component
requirement to already be set. When logic was added to properly fill the
sets (which is needed for CPS), it blindly dumped all components into
the required set, without actually checking whether the context had
marked the components as required or optional.

Fixes: #26824
2025-04-02 10:16:40 -04:00