summaryrefslogtreecommitdiffstats
path: root/Help/command/find_package.rst
diff options
context:
space:
mode:
authorEugene Shalygin <eugene.shalygin@gmail.com>2021-07-07 12:41:34 (GMT)
committerBrad King <brad.king@kitware.com>2021-07-08 12:03:38 (GMT)
commita2e9fe38e43bd73513cde410f83e53e0c31ec6d6 (patch)
tree5967cc1531f5a4f5c561c6d1159c9a98db434036 /Help/command/find_package.rst
parentd49b507bb6fb798bdab3edc738af80495efa979f (diff)
downloadCMake-a2e9fe38e43bd73513cde410f83e53e0c31ec6d6.zip
CMake-a2e9fe38e43bd73513cde410f83e53e0c31ec6d6.tar.gz
CMake-a2e9fe38e43bd73513cde410f83e53e0c31ec6d6.tar.bz2
find_package: Add variable to make package REQUIRED
Add a `CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` variable is complement to `CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` with just the opposite behaviour: it turns non-required find_package call into the required one. While optional package dependencies usually result in simple and clean build logic, sometimes people want to be sure those optional dependencies will be found and used. Examples are reproducible builds and build instructions for 3rd parties. People choose to make find_package calls REQUIRED and put them behind an option(). Such workarounds blend build logic with build environment management and do not look elegant.
Diffstat (limited to 'Help/command/find_package.rst')
-rw-r--r--Help/command/find_package.rst11
1 files changed, 9 insertions, 2 deletions
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 3dfd62f..7febd5d 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -448,8 +448,15 @@ which the file is found. The :variable:`CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS`
variable may be set to ``TRUE`` before calling ``find_package`` in order
to resolve symbolic links and store the real path to the file.
-Every non-REQUIRED ``find_package`` call can be disabled by setting the
-:variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable to ``TRUE``.
+Every non-REQUIRED ``find_package`` call can be disabled or made REQUIRED:
+
+* Setting the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable
+ to ``TRUE`` disables the package.
+
+* Setting the :variable:`CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` variable
+ to ``TRUE`` makes the package REQUIRED.
+
+Setting both variables to ``TRUE`` simultaneously is an error.
Package File Interface Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^