Commit Graph

1677 Commits

Author SHA1 Message Date
Brad King
8dfb1f40b7 Merge topic 'execute_process-cmd-bat'
74c9d40876 execute_process: Fix invocation of .cmd/.bat with spaces
104ca10208 cmWorkerPool: Adopt MaybePrependCmdExe calls to reduce duplication
cf7ba6d43d cmWorkerPool: Convert RunCommand signature to move semantics
c091fd1420 cmUVProcessChain: Convert AddCommand signature to move semantics
c1f6b04176 cmSystemTools: Teach MaybePrependCmdExe to always use backslashes
817b3967f8 cmSystemTools: Teach MaybePrependCmdExe to return GetShortPathNameW failure
611a3000f7 cmSystemTools: Make MaybePrependCmdExe case-insensitive
98fed0f116 cmSystemTools: Adopt MaybePrependCmdExe

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10270
2025-02-04 09:02:48 -05:00
Brad King
0c5898558e Merge topic 'find-cps-components'
894f256a12 find_package: Find CPS components
ac20cd43c0 find_package: Fix reporting of transitive dependency errors

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10262
2025-02-03 10:07:25 -05:00
Brad King
74c9d40876 execute_process: Fix invocation of .cmd/.bat with spaces
The `CreateProcessW` documentation states "to run a batch file, you must
start the command interpreter".  Use `cmd /c the.bat` to run batch files.
Also, use a "short path" to the `.bat` file if needed to avoid spaces.

Previously this worked in some cases only due to undocumented behavior
of `CreateProcessW` when given a `.bat` file.

Fixes: #26655
2025-02-03 09:13:26 -05:00
Matthew Woehlke
894f256a12 find_package: Find CPS components
Implement finding components of CPS packages. Specifically, reject any
candidate packages that don't provide all required components, and
ignore appendices that don't provide requested (required or optional)
components. This applies to both top-level searches and also searching
for package dependencies.
2025-02-01 06:44:43 -05:00
Nikita Nemkin
9c963de998 Help: Remove stray spaces and one colon 2025-01-31 12:23:29 -05:00
Nikita Nemkin
51e4d81f16 Help: Remove accidental blockquotes around lists
Indenting a list relative to the previous paragraph creates
a blockquote. Combined with the natural list indent it results
in an overly large left margin.
2025-01-31 12:23:29 -05:00
Nikita Nemkin
718043b540 Help: Convert some literal blocks into tables and lists
Also, ensure that header-less tables have a top border in cmake.css.
2025-01-31 12:23:29 -05:00
Brad King
3e64c6a56e Merge topic 'msvc-runtime-checks'
2b2344b412 MSVC: Add abstraction for runtime checks
49dcd1ce5d Help: Fix MSVC_DEBUG_INFORMATION_FORMAT description of example
2f8e643d9d CMP0141: Fix documentation copied from CMP0091

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !10214
2025-01-30 08:48:01 -05:00
Nikita Nemkin
9890cfc4ec Help: More syntax highlighting for literal blocks
Covers almost all blocks containing actual code, except:

* Parsed-literal blocks can't be highlighted, including many command
  summaries and substitution-heavy docs like find_... commands.
  This is a Sphinx limitation.

* Code with errors, like CMP0049, DEPLOYMENT_ADDITIONAL_FILES,
  DEPLOYMENT_REMOTE_DIRECTORY, @PACKAGE_INIT@ substitution in the
  tutorial, bracket arguments/comments in cmake-language.7 and
  cmake-developer.7.

* FindQt4 module, which needs reformatting.
2025-01-29 16:48:53 -05:00
AJIOB
2b2344b412 MSVC: Add abstraction for runtime checks
Replace our hard-coded default for `/RTC1` with a first-class
abstraction to select runtime checks from an enumeration of logical
names.  Add a `MSVC_RUNTIME_CHECKS` target property and corresponding
`CMAKE_MSVC_RUNTIME_CHECKS` variable.

Removing the old default flag requires a policy because existing
projects may rely on string processing to edit them and choose
runtime checks under the old behavior.  Add policy CMP0184 to
provide compatibility.

Fixes: #26614
2025-01-29 13:07:41 -05:00
Brad King
ec7cc80370 Merge topic 'patch-lower-case-style'
4e6a13f211 Use lower case style for commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Merge-request: !10245
2025-01-29 11:37:51 -05:00
Brad King
e509c0a423 Merge topic 'patch-else'
9f2efc3270 Remove optional arguments from else() and end*() commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Merge-request: !10243
2025-01-29 11:35:30 -05:00
Peter Kokot
4e6a13f211 Use lower case style for commands
Where possible this syncs the CS for command names:

- check_c_source_compiles()
- check_cxx_compiler_flag()
- check_cxx_source_compiles()
- check_cxx_symbol_exists()
- check_include_file_cxx()
- check_include_file()
- check_include_files()
- check_library_exists()
- check_source_compiles()
- check_struct_has_member()
- check_symbol_exists()
- check_type_size()
- cmake_dependent_option()
- cmake_parse_arguments()
- feature_summary()
- file()
- find_package_handle_standard_args()
- if(), endif...
- install(FILES)
- list()
- message()
- pkg_check_modules()
- select_library_configurations()
- set_package_info()
- test_big_endian()
2025-01-28 13:51:46 -05:00
Peter Kokot
477737b7bf
load_cache: Add note about export()
The export() command can be a better option when outside project can be
adjusted in such way.
2025-01-28 15:22:29 +01:00
Brad King
aeff709a27 Merge topic 'patch-load-cache-script-mode'
18ae68a97c load_cache: Mention script mode support (-P)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10241
2025-01-28 09:19:58 -05:00
Brad King
d6a7a83700 Merge topic 'fix-typos-found-by-pygrep-hooks'
bc4c71627a Help: Fix typos found by the `rst-backticks` hook
c833629508 Help: Fix typos found by the `rst-directive-colons` hook

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10237
2025-01-28 08:35:19 -05:00
Peter Kokot
9f2efc3270
Remove optional arguments from else() and end*() commands
This adds a brief explanation of the optional condition in the `else()`
and removes all legacy usages of `else()` and `end*()` commands.
2025-01-28 03:01:23 +01:00
Peter Kokot
18ae68a97c
load_cache: Mention script mode support (-P)
When using the relevant load_cache(READ_WITH_PREFIX) signature, it also
works in script mode (cmake -P ...), unlike the 2nd obsolete signature.
2025-01-28 00:59:50 +01:00
Brad King
3ffac3063d Merge topic 'doc-policy-deprecation-schedule'
3e0720a2ae Help: Add cmake_minimum_required(VERSION) example to cmake-policies(7)
085de39879 Help: Document policy transition schedule in cmake-policies(7)
60e302a539 Help: Drop policy scope from cmake-policies(7)
3b926b32e3 Help: Drop CMAKE_MINIMUM_REQUIRED_VERSION from cmake-policies(7)
ec9e5feb93 Help: Organize cmake-policies(7) by supported and unsupported policies
6be0fe22be Help: Mention CMAKE_POLICY_DEFAULT_CMP<NNNN> in cmake_minimum_required

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10222
2025-01-27 11:18:46 -05:00
Brad King
084f6055a8 Merge topic 'patch-CMAKE_OBJDUMP'
dc7aabf4d0 Help: Document CMAKE_OBJDUMP variable
4bd3519e89 CPack: Avoid mentioning internal CMake module in documentation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10224
2025-01-27 10:30:58 -05:00
Brad King
304f086b71 Merge topic 'doc-cmake_host_system_information-OS_NAME'
ff11a95962 Help: Clarify cmake_host_system_information OS_NAME

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Nicole Mazzuca <nicole.mazzuca@remarkable.no>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !10232
2025-01-27 10:26:33 -05:00
Alex Turbov
bc4c71627a
Help: Fix typos found by the rst-backticks hook
The corresponding `pre-commit` configuration is coming in the
separate MR.

Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2025-01-27 01:43:26 +04:00
scivision
7be01178a0 Help: JSON argument should be quoted
The error that results from a semicolon anywhere in a JSON string
is not obvious.

Issue: #26628
2025-01-24 12:00:56 -05:00
Brad King
ff11a95962 Help: Clarify cmake_host_system_information OS_NAME
Fixes: #26631
2025-01-24 10:58:35 -05:00
Peter Kokot
dc7aabf4d0 Help: Document CMAKE_OBJDUMP variable 2025-01-24 10:43:18 -05:00
Brad King
5f6114f8b8 Merge topic 'patch-load-cache'
6fc8d20250 load_cache: Improve explanation of command signatures

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10216
2025-01-24 10:20:13 -05:00
Brad King
6be0fe22be Help: Mention CMAKE_POLICY_DEFAULT_CMP<NNNN> in cmake_minimum_required
We already mention it in equivalent text for `cmake_policy`.
2025-01-23 09:41:08 -05:00
Brad King
1d4d4362d9 Merge topic 'remove-old-compatibility'
77f71ad4e2 Remove compatibility with CMake versions older than 3.5
fb1bd1d330 CMP0065: Remove support for OLD behavior
d9dd38cccf CMP0064: Remove support for OLD behavior
d88047c329 Remove compatibility with CMake versions older than 3.3
ac1a9cb160 CMP0063: Remove support for OLD behavior
36fffb673a CMP0062: Remove support for OLD behavior
789a7d73d4 CMP0061: Remove support for OLD behavior
3dc19e24cb CMP0060: Remove support for OLD behavior
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10210
2025-01-23 09:36:59 -05:00
Brad King
63924c4afa Merge topic 'ci-typos'
c3777c1536 ci: Extend spellcheck job with 'typos' tool
d11552c2d9 codespell: Exclude paths by patterns following pre-commit check conventions
11d0a631d4 codespell: Split multi-valued configuration across multiple lines
54dfadaf5a ci: Rename "codespell" job to more general name "spellcheck"
17fc94e5e3 ci: Add typos 1.29.4 to Fedora base image
ddf8220572 ci: Use Fedora 41 default flang package now that it is new enough
1e2d19ea4f gitignore: Tell tools honoring .gitignore to ignore .git too
0d0a94bcfb Tests: Fix Fortran syntax for initialized variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10211
2025-01-23 09:34:02 -05:00
Peter Kokot
6fc8d20250
load_cache: Improve explanation of command signatures
This extends the descriptions of command signatures and options.
Additional examples are listed at the bottom for better understanding
and overview of this command.
2025-01-22 23:40:39 +01:00
Brad King
77f71ad4e2 Remove compatibility with CMake versions older than 3.5
This compatibility has been deprecated since commit 3a4791548d
(Deprecate compatibility with CMake versions older than 3.5, 2023-02-09,
v3.27.0-rc1~508^2).  The behavior itself has been deprecated
since CMake 3.5.

Issue: #26613
2025-01-22 10:40:55 -05:00
Brad King
fb1bd1d330 CMP0065: Remove support for OLD behavior 2025-01-22 10:40:55 -05:00
Brad King
d88047c329 Remove compatibility with CMake versions older than 3.3
This compatibility has been deprecated since commit 3a4791548d
(Deprecate compatibility with CMake versions older than 3.5, 2023-02-09,
v3.27.0-rc1~508^2).  The behavior itself has been deprecated
since CMake 3.3.

Issue: #26613
2025-01-22 10:40:54 -05:00
Brad King
789a7d73d4 CMP0061: Remove support for OLD behavior 2025-01-22 10:40:54 -05:00
Brad King
3dc19e24cb CMP0060: Remove support for OLD behavior 2025-01-22 10:40:54 -05:00
Alex Turbov
c3777c1536 ci: Extend spellcheck job with 'typos' tool
Unlike the `codespell`, `typos` is capable of finding typos
in combined identifiers (`CamelCase` or `snake_case`).
2025-01-22 08:51:45 -05:00
Brad King
e7a90d0551 Help: Document CTEST_EXTRA_SUBMIT_FILES variable 2025-01-21 14:55:14 -05:00
Brad King
123e002168 Help: Document CTEST_NOTES_FILES variable 2025-01-21 14:52:14 -05:00
Brad King
2782d095b0 Remove compatibility with CMake versions older than 3.2
This compatibility has been deprecated since commit 3a4791548d
(Deprecate compatibility with CMake versions older than 3.5, 2023-02-09,
v3.27.0-rc1~508^2).  The behavior itself has been deprecated
since CMake 3.2.

Issue: #26613
2025-01-21 09:44:05 -05:00
Brad King
cbe7fc4b81 CMP0056: Remove support for OLD behavior 2025-01-21 09:44:05 -05:00
Brad King
7a39d926e8 Merge topic 'remove-old-compatibility'
381c446ff7 VS: Remove support for appending a platform to the generator name
dc24d88062 Remove compatibility with CMake versions older than 3.1
90d814f024 CMP0054: Remove support for OLD behavior
292aaffb78 Source: Remove unused cmCommandArgument{Lexer,Parser}
1150fae89a CMP0053: Remove support for OLD behavior
f0b1ca4d70 CMP0052: Remove support for OLD behavior
e4fddc8e37 CMP0051: Remove support for OLD behavior

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10205
2025-01-21 09:43:10 -05:00
Brad King
2902d3f827 Merge topic 'patch-file-make-directory'
2e02e5589d file(MAKE_DIRECTORY): Document current source directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !10203
2025-01-21 09:32:46 -05:00
Brad King
a91a01747d Merge topic 'patch-installation-components'
5a974b99fe install: Document where the components are used

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10202
2025-01-21 09:31:05 -05:00
Brad King
dc24d88062 Remove compatibility with CMake versions older than 3.1
This compatibility has been deprecated since commit 3a4791548d
(Deprecate compatibility with CMake versions older than 3.5, 2023-02-09,
v3.27.0-rc1~508^2).  The behavior itself has been deprecated
since CMake 3.1.

Issue: #26613
2025-01-20 09:46:55 -05:00
Brad King
90d814f024 CMP0054: Remove support for OLD behavior 2025-01-20 09:46:55 -05:00
Peter Kokot
2e02e5589d
file(MAKE_DIRECTORY): Document current source directory
Relative paths in the directories list argument are treated as relative
to the current source directory.
2025-01-20 14:59:38 +01:00
Peter Kokot
5a974b99fe
install: Document where the components are used 2025-01-20 12:02:23 +01:00
Brad King
8e0a0291ef Remove compatibility with CMake versions older than 3.0
This compatibility has been deprecated since commit 3a4791548d
(Deprecate compatibility with CMake versions older than 3.5, 2023-02-09,
v3.27.0-rc1~508^2).  The behavior itself has been deprecated
since CMake 3.0.

Issue: #26613
2025-01-19 09:41:04 -05:00
Brad King
3c4afba8cc Remove compatibility with CMake versions older than 2.8.12
This compatibility has been deprecated since commit 5845c218d7
(Deprecate compatibility with CMake versions older than 2.8.12,
2020-06-12, v3.19.0-rc1~629^2).  The behavior itself has been
deprecated since CMake 2.8.12.

Issue: #26613
2025-01-18 09:51:45 -05:00
Brad King
785523a136 Remove compatibility with CMake versions older than 2.8.0
This compatibility has been deprecated since commit 5845c218d7
(Deprecate compatibility with CMake versions older than 2.8.12,
2020-06-12, v3.19.0-rc1~629^2).  The behavior itself has been
deprecated since CMake 2.8.0.

Issue: #26613
2025-01-17 09:36:10 -05:00
Brad King
bd176b430c Renumber post-3.31 development from 3.32 to 4.0
Issue: #26613
2025-01-16 09:18:21 -05:00
Brad King
1d5c1b0023 Merge topic 'policy-cleanup'
b010a1fb1d Help: Update try_compile list of automatic policies
5e9b40b6a5 Help: Update cmake-buildsystem(7) TARGET_POLICY example to a newer policy
9ffbc0e628 Tests/RunCMake/cmake_minimum_required: Generalize deprecated version case name
0eca249ac7 Tests/RunCMake: Update more cmake_minimum_required versions to 3.10
a8cf033a74 Tests/RunCMake/return: Use newer cmake_minimum_required VERSION

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10178
2025-01-16 09:01:48 -05:00
Brad King
e87c6c6259 Merge topic 'execute-process-error'
3ece058d97 execute_process: Allow setting default COMMAND_ERROR_IS_FATAL value
85035dd954 Help/command/execute_process: Fix definition list formatting

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10169
2025-01-16 08:59:00 -05:00
Brad King
8018f2a6c4 Merge topic 'instrumentation'
097d4fd1b5 instrumentation: Collect and record project build system metrics
8a3c195188 Tests/RunCMake: Add RunCMake_CHECK_ONLY Option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !9791
2025-01-16 08:55:25 -05:00
Brad King
b010a1fb1d Help: Update try_compile list of automatic policies 2025-01-15 11:21:21 -05:00
Martin Duffy
3ece058d97 execute_process: Allow setting default COMMAND_ERROR_IS_FATAL value
Issue: #26576
2025-01-15 11:12:34 -05:00
Martin Duffy
097d4fd1b5 instrumentation: Collect and record project build system metrics
Add a feature for collecting build instrumentation for CMake projects.

Issue: #26099
2025-01-15 09:16:50 -05:00
Brad King
85035dd954 Help/command/execute_process: Fix definition list formatting 2025-01-13 13:34:15 -05:00
Peter Kokot
d7b33ed8e2
file(MAKE_DIRECTORY): Update synopsis signature
This syncs the signature as it provides another optional option.
2025-01-07 02:15:33 +01:00
scivision
9be6e42499 Help: Note try_compile/try_run caching 2024-12-18 10:04:47 -05:00
Brad King
135e6feba9 Merge topic 'find-cps'
d00201afd6 Tests: Add tests for CPS find_package
65429611b9 find_package: Fix handling of relative paths in CPS
5236984a08 Help: Describe CPS support in find_package
34828650d6 find_package: Add experimental gate for CPS support
25cc83428e find_package: Actually import .cps files
91c31ada23 find_package: Actually find .cps files
b89e43b2bc find_package: Start implementing CPS search
3e9f96079d Add additional string case functions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10018
2024-12-17 10:12:24 -05:00
Brad King
ef1300749c Merge topic 'ci-linkcheck'
25b25a7724 Help: Update link to UTF-8 RFC 3629

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10103
2024-12-17 10:07:47 -05:00
Brad King
25b25a7724 Help: Update link to UTF-8 RFC 3629
The old link now returns 404.
2024-12-16 09:20:23 -05:00
Brad King
987f3fa4e0 Help: Add cmake-buildsystem(7) subsections for each binary target type
Re-organize the "Binary Targets" section of the manual to have a
dedicated subsection for each kind of binary target.  Initialize each
subsection by documenting the object file and link semantics of the
corresponding target type.
2024-12-13 09:53:26 -05:00
Matthew Woehlke
5236984a08 Help: Describe CPS support in find_package
Update find_package documentation to describe (the current state of)
support for Common Package Specification packages. Make some general
improvements to the same while we're at it. Add documentation blurb for
the experimental flag that enables CPS support.
2024-12-13 08:58:24 -05:00
Matthew Woehlke
b89e43b2bc find_package: Start implementing CPS search
Teach find_package to search CPS search paths, and to look for CPS file
names. Modify the set of file names to also include the file type (CPS
or CMake-script). Modify the search function to allow specifying which
file type(s) to consider.

During full path search, each possible path is searched for only one of
the two possible file types. However, subsequent runs, or when
considering a user-specified path (<name>_DIR), CMake will look for both
file types.

Note that this only adds the new path search logic as described above;
CMake does not yet know how to read CPS files, and there is a high
likelihood that Bad Things will happen if it tries. However, this seemed
like a good place to checkpoint.
2024-12-13 08:58:24 -05:00
SunBlack
041537e5ce Help: Clarify find_package version range limitation
Issue: #26470
2024-11-26 09:25:15 -05:00
Brad King
242702803f Merge topic 'doc-if-path'
3530eef3fb Help: Clarify that if(PATH_EQUAL) does not access the filesystem

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Marc Chevrier <marc.chevrier@gmail.com>
Merge-request: !10001
2024-11-20 09:25:29 -05:00
scivision
3530eef3fb Help: Clarify that if(PATH_EQUAL) does not access the filesystem
Fixes: #26421
2024-11-19 12:01:03 -05:00
Craig Scott
30f596f417 Merge topic 'cmp0175-restore-USES_TERMINAL-for-TARGET-form'
62586f236c CMP0175: Do not reject USES_TERMINAL for add_custom_command(TARGET)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10005
2024-11-16 16:16:48 -05:00
Craig Scott
62586f236c
CMP0175: Do not reject USES_TERMINAL for add_custom_command(TARGET)
Fixes: #26449
2024-11-16 10:02:01 +11:00
Marc Chevrier
35350c419d Add support of "LINKER:" prefix for CMAKE_<TYPE>_LINKER_FLAGS variable
The following variables now support the LINKER: prefix:
* CMAKE_<TYPE>_LINKER_FLAGS
* CMAKE_<TYPE>_LINKER_FLAGS_<CONFIG>

Fixes: #26171
2024-11-04 17:07:58 +01:00
Brad King
e83535f5a3 Merge topic 'improve-package-search'
6f3dc1161a find_package: Also sort Framework matches
e90f60f864 find_package: Don't glob certain macOS paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9942
2024-10-25 08:25:34 -04:00
Brad King
0ba8bdb5c2 Merge topic 'doc-BUILD_TESTING'
9510820d58 Help: Document CTest module BUILD_TESTING variable
6e6e688b80 CTest: Improve formatting of documentation cmake code blocks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9927
2024-10-25 08:23:25 -04:00
Matthew Woehlke
6f3dc1161a find_package: Also sort Framework matches
Add cmAnyDirectoryListGenerator, which matches any directory but also
sorts matches in the same manner as cmProjectDirectoryListGenerator.
Modify SearchFrameworkPrefix to use this, in combination with a literal
path (cmAppendPathSegmentGenerator), instead of cmFileListGeneratorGlob
(which is removed, as it is no longer used). This improves the
consistency of when sorting is available.

This uses cmDirectoryListGenerator's new ability to match anything, as
mentioned in the previous commit.
2024-10-24 13:42:42 -04:00
Robert Maynard
9510820d58 Help: Document CTest module BUILD_TESTING variable
The `BUILD_TESTING` variable is referenced in `add_test` and
`enable_testing`.  It should be documented as it controls the
behavior tests working when projects use `include(CTest)`.
2024-10-24 11:46:37 -04:00
Brad King
3ef7198e43 Merge topic 'fix-path-search-doc'
630e4a12a3 Help: Fix find_package search order w.r.t. globs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Matthew Woehlke <matthew.woehlke@kitware.com>
Merge-request: !9930
2024-10-24 08:59:43 -04:00
Matthew Woehlke
630e4a12a3 Help: Fix find_package search order w.r.t. globs
Add documentation to clarify that `find_package` searches paths in the
specified order and stops at the first match.  Clarify documentation of
`CMAKE_FIND_PACKAGE_SORT_*` to match the actual behavior.

Note that no behavior is actually changed, this merely improves the
documentation to reflect actual behavior rather than seeming to imply
something else.

Also, update the test to verify that what we claim in the updated
documentation is what's actually happening.
2024-10-23 12:46:07 -04:00
Brad King
9b2fcb7779 Merge topic 'LINKER-prefix-support-for-libraries'
aba1c9d172 target_link_libraries: Add support for the LINKER: prefix

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9882
2024-10-12 10:30:12 -04:00
Marc Chevrier
aba1c9d172 target_link_libraries: Add support for the LINKER: prefix
It is now possible to use the `LINKER:` prefix in `LINK_LIBRARIES`
and `INTERFACE_LINK_LIBRARIES` target properties.

Fixes: #26318
2024-10-11 17:54:02 +02:00
Daniel Pfeifer
267b42bccc CTest: Remove declarative scripting mode 2024-10-09 22:30:58 +02:00
Brad King
aa6bbc3135 Help: Update Sphinx versionadded directives for 3.31 release
Run the script:

    Utilities/Sphinx/update_versions.py --since v3.30.0 --overwrite
2024-10-09 09:32:54 -04:00
Craig Scott
e5a9ccbcc8 project: Always set <PROJECT-NAME>_* as normal variables
Re-introduce the behavior originally introduced in CMake 3.30.3 by
commit c1ece78d11 (project: non cache <project> prefix variables are
also created, 2024-08-27, v3.30.3~2^2), but this time with a policy for
compatibility.

Issue: #25714
Issue: #26243
2024-10-08 10:07:11 -04:00
Brad King
dc371e07fb Merge topic 'project-vars'
fa07ddfebf project: Only check non-cache vars when setting project vars

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9883
2024-10-08 08:45:26 -04:00
Craig Scott
fa07ddfebf project: Only check non-cache vars when setting project vars
The change in commit 86ad7cc886 (project: Only define non-cache vars if
already defined, 2024-09-15, v3.30.4~2^2) was meant to only check for
non-cache variables when deciding whether to set non-cache project
variables for the current call.  However, it erroneously checked for any
variable, including cache variables.  This gives the intended result on
the first run, but on subsequent runs a cache variable will exist that
did not on the first run, leading to different behavior between the two
runs.  Fix the logic to only check for a pre-existing non-cache
variable, as was originally intended.

Fixes: #26355
2024-10-07 10:24:37 -04:00
Brad King
84db8506ff Deprecate compatibility with CMake versions older than 3.10
Issue a deprecation warning on calls to `cmake_minimum_required` or
`cmake_policy` that set policies based on versions older than 3.10.
Note that the effective policy version includes `...<max>` treatment.
Update the check from commit 3a4791548d (Deprecate compatibility with
CMake versions older than 3.5, 2023-02-09, v3.27.0-rc1~508^2).
2024-10-03 14:18:26 -04:00
scivision
7a88ca2e56 Help: Document find_program filename suffix behavior
Issue: #16453
2024-10-03 08:00:41 -04:00
Brad King
f7e2422c3e Merge topic 'curl-tls-version'
38390245a2 ctest: Require minimum TLS 1.2 by default
5e1a59dc2b file(DOWNLOAD/UPLOAD): Require minimum TLS 1.2 by default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9848
2024-09-27 08:03:01 -04:00
Brad King
5e1a59dc2b file(DOWNLOAD/UPLOAD): Require minimum TLS 1.2 by default
Fixes: #25701
2024-09-26 10:10:20 -04:00
Brad King
53f3e5da1e Merge topic 'link-strategy'
7abd3137b7 Linking: Optionally reorder direct dependencies from LINK_LIBRARIES
9285a9dc9a cmComputeLinkDepends: Add final dependency ordering to debug output
f792db4ca2 cmComputeLinkDepends: Add undocumented per-target debug property
80b469a51d cmComputeLinkDepends: Factor out string literals as named constants
3bd73fcc76 cmComputeLinkDepends: Modernize member initialization
8db69c767b cmComputeLinkDepends: Remove redundant member
dccdd030cd cmComputeLinkDepends: Replace depender index sentinel value with cm::optional
6c9d8dc243 cmComputeLinkDepends: Replace group index sentinel value with cm::optional
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9835
2024-09-26 08:47:47 -04:00
Brad King
6b7e634b7c Help: Explicitly state include_external_msproject is only for VS generators
Fixes: #19975
2024-09-25 07:24:32 -04:00
Brad King
7abd3137b7 Linking: Optionally reorder direct dependencies from LINK_LIBRARIES
Traditionally CMake generates link lines by starting with the direct
link dependencies specified by `LINK_LIBRARIES` in their original order
and then appending indirect dependencies that the direct dependencies
do not express.  This gives projects control over ordering among
independent entries, which can be important when intermixing flags
and libraries, or when multiple libraries provide the same symbol.
However, it may also result in inefficient link lines.

Add support for an alternative strategy that can reorder direct link
dependencies to produce more efficient link lines.  This is useful
for projects that cannot easily specify their targets' direct
dependencies in an order that satisfies indirect dependencies.

Add a `CMAKE_LINK_LIBRARIES_STRATEGY` variable and corresponding
`LINK_LIBRARIES_STRATEGY` target property to select a strategy.

Fixes: #26271
2024-09-25 06:48:57 -04:00
Brad King
ea3405ff60 Merge topic 'curl-tls-verify'
4e62bc943c ctest: Verify TLS server certificate by default
8e92ee34f6 file(DOWNLOAD/UPLOAD): Verify TLS server certificate by default
dcaea54898 cmCTestCurl: Clarify names and logic using optional<bool>
03d37ae3ff cmFileCommand: Clarify names and logic using optional<bool>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9843
2024-09-24 10:35:19 -04:00
Brad King
8e92ee34f6 file(DOWNLOAD/UPLOAD): Verify TLS server certificate by default
If the connection fails in a way that might be a certificate error, and
verification was enabled by the new default, mention environment
variable `CMAKE_TLS_VERIFY` in the diagnostic to help users that were
relying on the old behavior turn off server certificate verification in
their environment.

Fixes: #23608
2024-09-24 08:37:23 -04:00
Brad King
c5f7e3bc3b Merge branch 'backport-project-vars' into project-vars 2024-09-20 10:35:02 -04:00
Craig Scott
86ad7cc886 project: Only define non-cache vars if already defined
In c1ece78d11 (project: non cache <project> prefix variables are
also created, 2024-08-27), we started explicitly setting the non-cache
variable for <projectName>_SOURCE_DIR, <projectName>_BINARY_DIR,
and <projectName>_IS_TOP_LEVEL in addition to setting them as
cache variables. This changed the behavior when a project name
was used more than once, and the second project call happens in
the same scope or a child scope of the first. Previously, the first
project call would set cache variables, and the second project call
would not overwrite those cache variables. With the change in
c1ece78d11, after the second project call the non-cache variables
would mask the cache variables and the project code would see
a different value to what it did before.

Setting the non-cache variable was added to handle the case where
a call to FetchContent_MakeAvailable() would set some non-cache
variables, and it just so happened those matched the same cache
variables that the project() command would set in the project being
fetched. The fetched project would then see a different set of
project-specific variables compared to when it was built standalone.

This commit here narrows the change from c1ece78d11 such that
the non-cache variable is only set by project() if there was already
a non-cache variable set. This still fixes the motivating problem
c1ece78d11 was intended to solve, but it avoids changing the variable
values seen by a project that re-uses the same project name in related scopes.

Issue: #26243, #25714
Fixes: #26281
2024-09-20 10:33:25 -04:00
Craig Scott
4c152752da Help: State valid scopes for using proj_SOURCE_DIR and proj_BINARY_DIR
Issue: #25714
2024-09-20 10:33:25 -04:00
Brad King
fdceee50e6 Merge topic 'normalize-install-destination-paths'
6a1fac1450 install: Normalize DESTINATION paths
2184fcfb00 Tests: Configure RunCMake.install cases with correct build type
5a8a6dfe81 cmGeneratorExpression: Change Find() parameter type to cm::string_view
d810374b3d install(PACKAGE_INFO): Remove outdated TODO comment
d13ed01d54 Tests: Remove unused files from RunCMake.install

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9800
2024-09-20 10:27:30 -04:00
Craig Scott
6a1fac1450
install: Normalize DESTINATION paths
The file generated by install(EXPORT) computes _IMPORT_PREFIX
in a way that assumes a normalized path. If the DESTINATION
contains any ../ components, the computed _IMPORT_PREFIX
would be wrong. Force the DESTINATION path to be normalized,
subject to the new CMP0176 policy.

Also normalize all other DESTINATION paths for consistency,
except for INCLUDES DESTINATION, which is not strictly a
destination but rather a search path to add.

Fixes: #26252
2024-09-19 20:31:47 +10:00
Chen Linxuan
39603a7e5c install: Add TYPE LIBEXEC for FILES and DIRECTORY
Signed-off-by: Chen Linxuan <me@black-desk.cn>
2024-09-18 11:05:28 -04:00