Files
CMake/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst
Eugene Shalygin a2e9fe38e4 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.
2021-07-08 08:03:38 -04:00

15 lines
551 B
ReStructuredText

CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>
----------------------------------------
.. versionadded:: 3.22
Variable for making :command:`find_package` call ``REQUIRED``.
Every non-``REQUIRED`` :command:`find_package` call in a project can be
turned into ``REQUIRED`` by setting the variable
``CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>`` to ``TRUE``.
This can be used to assert assumptions about build environment and to
ensure the build will fail early if they do not hold.
See also the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable.