Skip to content

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.

Topic-rename: find_package-required-var

Edited by Brad King

Merge request reports