Add CMAKE_REQUIRE_FIND_PACKAGE_<PackageName> variable
We currently have the variable CMAKE_DISABLE_FIND_PACKAGE_<PackageName>
that disabled every (optional) find_package(PackageName)
.
I think it would be interesting to also introduce a CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>
variable.
This would logically transform every find_package(XXX)
into find_package(XXX REQUIRED)
.
Enabling both CMAKE_DISABLE_FIND_PACKAGE_XXX
and CMAKE_REQUIRE_FIND_PACKAGE_XXX
should be an error.
This variable would be interesting to make sure that a dependency is found (and used). Right now, a lot of cmake scripts are very flexible in that they optionally enable features when finding some dependency. This requires the packager checking the configure logs and/or running tests to check whether a feature is actually enabled.
With CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>
, you have greater assurance that when the configure step succeeded,
that the dependency has been found. (You should still test though)