summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-02-22 19:12:34 (GMT)
committerBrad King <brad.king@kitware.com>2023-02-23 14:12:29 (GMT)
commit4da27a73bd10665e753194a4a14323c9069e9289 (patch)
tree16c01f44d7a0b0ab3560f62b3e2a232bdfad304c
parentbfeb16bd5bc7fdeca0922d5f89a35fe4a3e19d1f (diff)
downloadCMake-4da27a73bd10665e753194a4a14323c9069e9289.zip
CMake-4da27a73bd10665e753194a4a14323c9069e9289.tar.gz
CMake-4da27a73bd10665e753194a4a14323c9069e9289.tar.bz2
Help: Document <PackageName>_ROOT variable ordering using an ordered list
Make room to add more steps in a documented order.
-rw-r--r--Help/command/FIND_XXX.txt37
-rw-r--r--Help/command/find_package.rst30
2 files changed, 41 insertions, 26 deletions
diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index bd55e24..09df8ba 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -140,21 +140,28 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
|prefix_XXX_SUBDIR| for each ``<prefix>`` in
:variable:`CMAKE_SYSTEM_PREFIX_PATH`
-1. .. versionadded:: 3.12
- If called from within a find module or any other script loaded by a call to
- :command:`find_package(<PackageName>)`, search prefixes unique to the
- current package being found. Specifically, look in the
- :variable:`<PackageName>_ROOT` CMake variable and the
- :envvar:`<PackageName>_ROOT` environment variable.
- The package root variables are maintained as a stack, so if called from
- nested find modules or config packages, root paths from the parent's find
- module or config package will be searched after paths from the current
- module or package. In other words, the search order would be
- ``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``,
- ``<ParentPackage>_ROOT``, ``ENV{<ParentPackage>_ROOT}``, etc.
- This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
- the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
- See policy :policy:`CMP0074`.
+1. If called from within a find module or any other script loaded by a call to
+ :command:`find_package(<PackageName>)`, search prefixes unique to the
+ current package being found. See policy :policy:`CMP0074`.
+
+ .. versionadded:: 3.12
+
+ Specifically, search paths specified by the following variables, in order:
+
+ a. :variable:`<PackageName>_ROOT` CMake variable,
+ where ``<PackageName>`` is the case-preserved package name.
+
+ b. :envvar:`<PackageName>_ROOT` environment variable,
+ where ``<PackageName>`` is the case-preserved package name.
+
+ The package root variables are maintained as a stack, so if called from
+ nested find modules or config packages, root paths from the parent's find
+ module or config package will be searched after paths from the current
+ module or package. In other words, the search order would be
+ ``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``,
+ ``<ParentPackage>_ROOT``, ``ENV{<ParentPackage>_ROOT}``, etc.
+ This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
+ the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
* |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX|
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index de4cb88..0162a1e 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -367,17 +367,25 @@ The set of installation prefixes is constructed using the following
steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are
enabled.
-1. .. versionadded:: 3.12
- Search paths specified in the :variable:`<PackageName>_ROOT` CMake
- variable and the :envvar:`<PackageName>_ROOT` environment variable,
- where ``<PackageName>`` is the package to be found
- (the case-preserved first argument to ``find_package``).
- The package root variables are maintained as a stack so if
- called from within a find module, root paths from the parent's find
- module will also be searched after paths for the current package.
- This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
- the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
- See policy :policy:`CMP0074`.
+1. Search prefixes unique to the current ``<PackageName>`` being found.
+ See policy :policy:`CMP0074`.
+
+ .. versionadded:: 3.12
+
+ Specifically, search prefixes specified by the following variables,
+ in order:
+
+ a. :variable:`<PackageName>_ROOT` CMake variable,
+ where ``<PackageName>`` is the case-preserved package name.
+
+ b. :envvar:`<PackageName>_ROOT` environment variable,
+ where ``<PackageName>`` is the case-preserved package name.
+
+ The package root variables are maintained as a stack so if
+ called from within a find module, root paths from the parent's find
+ module will also be searched after paths for the current package.
+ This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
+ the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
2. Search paths specified in cmake-specific cache variables. These
are intended to be used on the command line with a :option:`-DVAR=VALUE <cmake -D>`.