Merge topic 'fix-cps-component-documentation'

b8d4c58e6c Merge branch 'backport-fix-cps-component-documentation' into fix-cps-component-documentation
76e11bd4ea Help: Fix find_package documentation about CPS and COMPONENTS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10405
This commit is contained in:
Brad King
2025-03-04 13:44:51 +00:00
committed by Kitware Robot
+19 -22
View File
@@ -166,32 +166,29 @@ can be listed directly after ``OPTIONAL``, which is equivalent to listing
them after the ``COMPONENTS`` keyword. When the ``OPTIONAL`` keyword is given,
the warning output when a package is not found is suppressed.
Additional optional components may be listed after
``OPTIONAL_COMPONENTS``. If these cannot be satisfied, the package overall
can still be considered found, as long as all required components are
satisfied.
.. TODO Once CPS honors COMPONENTS, note that OPTIONAL_COMPONENTS will cause
CMake to attempt to locate dependencies for optional components. Also note
that CMake will *not* load any appendices that don't include COMPONENTS or
OPTIONAL_COMPONENTS. (That isn't the case now, but will be when we don't
just ignore COMPONENTS.) The following paragraph will also need changes.
Additional optional components may be listed after ``OPTIONAL_COMPONENTS``.
If these cannot be satisfied, the package overall can still be considered
found, as long as all required components are satisfied.
The set of available components and their meaning are defined by the
target package. For CMake-script package configuration files, it is formally
up to the target package how to interpret the component information given to
it, but it should follow the expectations stated above. For calls where no
components are specified, there is no single expected behavior and target
packages should clearly define what occurs in such cases. Common arrangements
include assuming it should find all components, no components or some
well-defined subset of the available components.
target package:
.. note::
* For CMake-script package configuration files, it is formally up to the target
package how to interpret the component information given to it, but it should
follow the expectations stated above. For calls where no components are
specified, there is no single expected behavior and target packages should
clearly define what occurs in such cases. Common arrangements include
assuming it should find all components, no components or some well-defined
subset of the available components.
If the experimental ``CMAKE_EXPERIMENTAL_FIND_CPS_PACKAGES`` is enabled,
CMake currently imports all available components if the located package
configuration file is a |CPS| file. At this time, ``COMPONENTS`` and
``OPTIONAL_COMPONENTS`` have no effect when considering a CPS file.
* |CPS| packages consist of a root configuration file and zero or more
appendices, each of which provide components and may have dependencies.
CMake always attempts to load the root configuration file. Appendices are
only loaded if their dependencies can be satisfied, and if they either
provide requested components, or if no components were requested. If the
dependencies of an appendix providing a required component cannot be
satisfied, the package is considered not found. Otherwise, that appendix
is ignored.
.. versionadded:: 3.24
The ``REGISTRY_VIEW`` keyword specifies which registry views should be