1b946dfbfe Merge branch 'backport-4.2-find_package-stack' into find_package-stack
e8ae3645db Merge branch 'backport-4.2-find_package-stack' into find_package-stack
aae02ee60a find_package: Share package information among copies of package stack
a789c21100 Merge branch 'backport-4.2-find_package-stack' into find_package-stack
9387988626 find_package: Save package information only after successfully loading it
561ece2407 cmFindPackageStack: Restore pure value semantics
e935ed22fb find_package: Share package information among copies of package stack
5aa649d5f6 find_package: Save package information only after successfully loading it
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11887
Since commit ae373e93fb (install(PACKAGE_INFO): Add version and location
to package dependencies, 2025-07-31, v4.2.0-rc1~340^2) we add package
information to the current package's stack entry as it is discovered.
However, a nested package can cause the current package's stack entry to
be replaced by a copy with a new ordering index due to commit c6e6861e63
(install(EXPORT): Export find_dependency() calls, 2023-11-07,
v3.29.0-rc1~439^2~1). Depending on whether imported targets were
created by the current package before finding the nested package, the
`CurrentPackageInfo` pointer is either invalidated, or left pointing at
only one of multiple copies.
Fix this by sharing a single instance of package information with all
copies of the current package's stack entry. Keep a mutable pointer
to the current package's information only while it is still pending.
This also avoids the need to expose mutation from the package stack.
Add a test that exposes the previously-invalidated pointer to dynamic
analysis tools.
Fixes: #27730
If a package configuration file sets `<PackageName>_FOUND` to false,
the package is considered not found. Do not save its package info.
Note that this exposes an existing pointer invalidation on nested
`find_package` calls, which will be fixed in following commits.
Issue: #27730
A stack entry's storage may be shared by other copies, so mutation is
incompatible with value semantics. We've migrated the motivating use
case to another approach.
Revert commit b3873b8272 (cmFindPackageStack: Allow controlled mutation,
2025-07-29, v4.2.0-rc1~438^2) and commit f2bdc2176f (cmStack: New,
mutable stack class, 2025-07-29, v4.2.0-rc1~438^2~1). Record their
parent as a second parent of this commit so `git blame` can see the
original history of the restored content.
Since commit ae373e93fb (install(PACKAGE_INFO): Add version and location
to package dependencies, 2025-07-31, v4.2.0-rc1~340^2) we add package
information to the current package's stack entry as it is discovered.
However, a nested package can cause the current package's stack entry to
be replaced by a copy with a new ordering index due to commit c6e6861e63
(install(EXPORT): Export find_dependency() calls, 2023-11-07,
v3.29.0-rc1~439^2~1). Depending on whether imported targets were
created by the current package before finding the nested package, the
`CurrentPackageInfo` pointer is either invalidated, or left pointing at
only one of multiple copies.
Fix this by sharing a single instance of package information with all
copies of the current package's stack entry. Keep a mutable pointer
to the current package's information only while it is still pending.
This also avoids the need to expose mutation from the package stack.
Add a test that exposes the previously-invalidated pointer to dynamic
analysis tools.
Fixes: #27730
If a package configuration file sets `<PackageName>_FOUND` to false,
the package is considered not found. Do not save its package info.
Note that this exposes an existing pointer invalidation on nested
`find_package` calls, which will be fixed in following commits.
Issue: #27730
c386aaebf8 FILE_SET: install and export SOURCES file set type
5c5b68f44e FILE_SET: Add support for the SOURCES type
5697bcced0 BT<> and cmLocalGenerator: Add helpers functions
42ca2a2062 cmEvaluatedTargetProperty: put declarations in namespace cm
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11863
67c84ef103 Help: Indicate that `ctest --test-dir` may be specified with a preset
02e9335d9c Help: Document that `cmake --preset` supports `-B` to override the build dir
c288ecddb2 Help: Revise versioning note for `cmake --build` with both dir and preset
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11880
67c84ef103 Help: Indicate that `ctest --test-dir` may be specified with a preset
02e9335d9c Help: Document that `cmake --preset` supports `-B` to override the build dir
c288ecddb2 Help: Revise versioning note for `cmake --build` with both dir and preset
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11880
This compiler uses GCC's standard library, and so limits `__cplusplus`
to that of the GCC toolchain. However, it defines feature macros that
we can use to distinguish this mode.
Add a handful of helper roles that allow many more command-line option
references to be written without explicit targets. Specifically, what
used to be written ':option:`--foo[=bar] <program --foo>` can now be
written ':program-option:`--foo`'. This allows many such references to
be significantly shortened.
For now, supported programs are 'cmake', 'cpack'. 'ctest',
'cmake--build' and 'cmake--install', which should cover most cases, but
more can be trivially added. Additionally, this does not make a
concerted effort to replace all existing uses, as it is intended mainly
for use in future updates.
Since commit 4a4986d28a (cxxmodules: support command templates for BMI
compilation, 2026-03-25, v4.3.1~2^2~1) we can express module interface
unit compilation to either object files or BMI-only in a way that works
with `clang-scan-deps` and `clang-cl` together.
Fixes: #25731