Commit Graph

1846 Commits

Author SHA1 Message Date
Brad King
8832f78dd6 IWYU: Update for Debian 13 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 13.  Some patterns:

* Types named in virtual `override` signatures no longer require
  includes since the overridden signature already names them.

* A function argument's type needs to be included even if its constructor
  is called only by implicit conversion.  For example, constructing a
  `std::function` from a lambda now requires `<functional>`.

* Some prior mysterious `<type_traits>` inclusions are no longer required.
2025-11-12 14:54:35 -05:00
Brad King
f6b3ba5f55 CMP0198: Maintain CMAKE_PARENT_LIST_FILE only when configuring projects
Revise commit 41aea12941 (Do not define CMAKE_PARENT_LIST_FILE in
CMakeLists.txt, 2025-07-05, v4.2.0-rc1~505^2).
2025-11-07 09:35:55 -05:00
Brad King
3593aa59ef cmake: Replace working mode with role 2025-11-07 09:35:55 -05:00
Brad King
e290d4f2a3 cmake: Infer command set from role 2025-11-07 09:35:54 -05:00
Brad King
0aab75bf0e cmake: Clarify name of enum backing CMAKE_ROLE property 2025-11-07 09:35:53 -05:00
Brad King
9e36f22684 cmake: Clarify name of enum identifying set of commands added 2025-11-07 09:35:53 -05:00
Brad King
5078d5be4f cmake: Clarify name of enum identifying try_compile 2025-11-07 09:35:53 -05:00
Brad King
26413a3e3d Merge topic 'file-GENERATE-CMP0189'
deb7b4b658 file(GENERATE): Record CMP0189 at each call site
9b862e7013 cmGeneratorTarget: Pass genex evaluation context to IsTransitiveProperty

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11234
2025-09-24 08:45:14 -04:00
Brad King
deb7b4b658 file(GENERATE): Record CMP0189 at each call site
Policy CMP0189, introduced by commit b3da9c6d60 (GenEx: Evaluate
LINK_LIBRARIES target properties transitively, 2025-02-24,
v4.1.0-rc1~731^2), takes effect at generation time, and so uses the
policy value as of the end of each directory.  However, some projects
may rely on `file(GENERATE)` with the policy's OLD behavior in order
to extract targets' *direct* dependencies from `LINK_LIBRARIES`.
Pending a first-class solution to that problem, make it easier for
projects to port to the policy's NEW behavior in general while
retaining the OLD behavior in an isolated context.

Fixes: #27220
2025-09-23 11:30:22 -04:00
Sergiu Deitsch
7040406f86 cmListFileLexer: Do not require null-terminated input 2025-09-12 18:28:55 +02:00
Brad King
29633b2f81 Merge topic 'ninja-status-unset-configure'
b5e06311c0 Ninja: Avoid non-standard output from `ninja` during `try_compile`
fe0e2fcaff ScopedEnv: add a RAII helper to temporarily manipulate the environment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Merge-request: !11143
2025-09-10 10:06:49 -04:00
John Drouhard
b5e06311c0 Ninja: Avoid non-standard output from ninja during try_compile
We sometimes parse the output from `ninja` during `try_compile`. Avoid
unexpected characters.

Fixes: #19316
2025-09-08 16:22:58 -05:00
Ben Boeckel
bbdc2fd908 cmSourceFile: internally track CMake-managed source files
These source file types don't necessarily show up in the CMake code, but
are side effects of other behaviors in CMake. Support tracking them
specially so that heuristics are not required to figure out if a given
`cmSourceFile` is one of them.
2025-09-08 11:59:57 -04:00
Taylor Sasser
ae373e93fb install(PACKAGE_INFO): Add version and location to package dependencies
Refactor `cmFindPackageStack` to track additional metadata
about <package> found. This includes two new fields,
`Version` and `Location` which correspond to package version and path.
The remaining package information will be implemented in a later commit
2025-08-12 11:07:09 -04:00
Matthew Woehlke
b3873b8272 cmFindPackageStack: Allow controlled mutation
As mentioned in the previous commit, we would like to record additional
information in the find-package stack, but we don't have the information
at the point a stack entry is created. This necessitates making the
stack mutable. However, in order to restrict mutation, do not directly
expose the mutable value, and instead arrange for it to be accessible
only via cmFindPackageStackRAII (renamed and extracted from cmMakefile).
This ensures that mutation can only happen while the stack is being
built.
2025-07-30 11:01:14 -04:00
Matthew Woehlke
f2bdc2176f cmStack: New, mutable stack class
We would like to record additional information in the find-package
stack, but we don't have the information at the point a stack entry is
created. The most sane way to handle this appears to be making the stack
mutable, at least under specific circumstances. To facilitate this, we
need a mutable stack type.

Refactor cmConstStack into cmStack, with the ability to either allow or
forbid mutation of its data. Re-add cmConstStack as a type alias.

This doesn't yet allow mutating cmFindPackageStack, but it's a necessary
step toward being able to do so.
2025-07-30 10:11:36 -04:00
Benjamin Buch
41aea12941 Do not define CMAKE_PARENT_LIST_FILE in CMakeLists.txt
Add policy `CMP0198` for compatibility.

Issue: #25026
2025-07-15 11:51:45 -04:00
Brad King
94ff184a63 Add deprecation warnings for policies CMP0143 and below
The OLD behaviors of all policies are deprecated, but only by
documentation.  Add an explicit deprecation diagnostic for policies
introduced in CMake 3.26 and below to encourage projects to port
away from setting policies to OLD.
2025-07-02 09:38:53 -04: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
Brad King
41708398eb cmMakefile: Factor out base class for list file scope RAII 2025-04-12 09:39:17 -04:00
Brad King
ce8be3da80 cmMakefile: De-duplicate CMAKE_CURRENT_LIST_FILE variable names 2025-04-12 09:39:17 -04:00
Daniel Pfeifer
46a0c04284 CTest: Allow setting exit code in ctest scripts 2025-03-20 16:31:49 +01:00
Brad King
b7abc78e6c Merge topic 'pkg-config-import-populate'
28a92bde80 PkgC: Implement cmake_pkg_config IMPORT / POPULATE
7f172faca5 Help: Add install() section heading for common options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10393
2025-03-12 09:06:04 -04:00
Vito Gamberini
28a92bde80 PkgC: Implement cmake_pkg_config IMPORT / POPULATE
Issue: #26067
2025-03-11 11:24:07 -04:00
Brad King
d84881dce6 Merge topic 'fix-cps-cmake-deps'
c3d279841b find_package: CPS component requirements != CMake components

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10427
2025-03-06 07:53:27 -05:00
Matthew Woehlke
c3d279841b find_package: CPS component requirements != CMake components
Modify how CMake handles required components of a CPS transitive
dependency to not pass them as COMPONENTS if a CMake-script package is
found as the resolved dependency. This is necessary as many CMake-script
package description files do not treat component requests as target
requests (which, in CPS-land, they effectively are), but do implement
logic to mark themselves 'not found' if requested components are
missing. As a result, passing in the required targets as required
components is likely to cause the dependency to be spuriously not found
if it is only available via a CMake-script package configuration file.

Fix this by introducing a new 'required targets' concept, and by passing
CPS component requirements as both required targets and optional
components. The latter serves as a hint for packages that might provide
only a subset of themselves. The former is used to post-validate a
CMake-script package, or is folded on-the-fly into required components
when considering CPS packages.

Note that this functionality is not exposed to the user at this time,
and is only used when resolving transitive dependencies for a CPS
package.
2025-03-05 14:47:49 -05:00
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Kitware Robot
de273b2e11 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 09:56:07 -05:00
Brad King
5cd2669146 Add deprecation warnings for policies CMP0142 and below
The OLD behaviors of all policies are deprecated, but only by
documentation.  Add an explicit deprecation diagnostic for policies
introduced in CMake 3.25 and below to encourage projects to port
away from setting policies to OLD.
2025-02-05 14:20:48 -05:00
Alex Turbov
d34971f455 Refactor: Eliminate redundant std::to_string as arg of cmStrCat
Plus optimize some other string operations in the modified files.
2025-01-26 04:03:38 +04:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -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
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
1393fbf13f CMP0059: Remove support for OLD behavior 2025-01-22 10:40:54 -05:00
Brad King
10cfc8f538 Merge topic 'extern-domain'
e109307c43 Add support for foreign targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10171
2025-01-22 09:30:49 -05:00
Vito Gamberini
e109307c43 Add support for foreign targets 2025-01-21 15:26:40 -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
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
Brad King
1150fae89a CMP0053: Remove support for OLD behavior 2025-01-20 09:46:55 -05: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
6973f8304e CMP0050: Remove support for OLD behavior 2025-01-19 09:41:03 -05:00
Brad King
292048874f CMP0048: Remove support for OLD behavior 2025-01-19 09:41:03 -05:00
Brad King
ed99370f63 CMP0043: Remove support for OLD behavior
Note that per-source `COMPILE_DEFINITIONS_<CONFIG>` are not covered by
the policy, and are still supported.
2025-01-19 09:41:02 -05:00
Brad King
cddac8736d CMP0040: Remove support for OLD behavior 2025-01-19 09:41:02 -05:00
Brad King
84f737545f CMP0037: Remove support for OLD behavior 2025-01-19 09:41:01 -05:00
Brad King
65b45de1dd CMP0024: Remove support for OLD behavior 2025-01-19 09:40:59 -05:00