Merge topic 'find-package-unwind'

f61768107e find_package: Implement UNWIND_INCLUDE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10943
This commit is contained in:
Brad King
2025-07-21 14:08:48 +00:00
committed by Kitware Robot
40 changed files with 404 additions and 8 deletions

View File

@@ -141,7 +141,8 @@ Basic Signature
[REGISTRY_VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
[GLOBAL]
[NO_POLICY_SCOPE]
[BYPASS_PROVIDER])
[BYPASS_PROVIDER]
[UNWIND_INCLUDE])
The basic signature is supported by both Module and Config modes.
The ``MODULE`` keyword implies that only Module mode can be used to find
@@ -249,6 +250,21 @@ of the ``NO_POLICY_SCOPE`` option.
itself. Future versions of CMake may detect attempts to use this keyword
from places other than a dependency provider and halt with a fatal error.
.. versionadded:: 4.2
The ``UNWIND_INCLUDE`` keyword is only allowed when ``find_package()`` is
being called within a parent call to ``find_package()``. When a call to
``find_package(UNWIND_INCLUDE)`` fails to find the desired package, it begins
an "unwind" state. In this state further calls to ``find_package()`` and
:command:`include()` are forbidden, and all parent :command:`include()`
commands will immediately invoke :command:`return()` when their scope is
reached. This "unwinding" will continue until the parent ``find_package()``
is returned to.
``UNWIND_INCLUDE`` is only intended to be used by calls to ``find_package()``
generated by :command:`install(EXPORT_PACKAGE_DEPENDENCIES)`, but may be
useful to those who wish to manually manage their dependencies in a similar
manner.
.. _`full signature`:
Full Signature

View File

@@ -0,0 +1,6 @@
find-package-UNWIND_INCLUDE
---------------------------
* The :command:`find_package()` command gained a new ``UNWIND_INCLUDE`` option
to enable immediate :command:`return` from :command:`include()` commands
after a failure to discover a transitive dependency.