mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 13:51:33 -06:00
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.
15 lines
551 B
ReStructuredText
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.
|