Mark dependencies as required when the build requires them
In CMake, if a dependency is not explicitly marked as REQUIRED, then if it's not present the build will continue and try to do... something, in the usual bash script fashion: set all environment variables to an empty string and cross fingers that everything will work anyhow.
This MR therefore proposes to mark every find_package statement whose dependency seems required for the build to succeed as REQUIRED. Whether a dependency is required was determined through the following criteria:
- If the CMake script uses the dependency (e.g. by expanding one of the Package_XYZ environment variables or linking to the dep) without checking if it has been found, then the dependency should be required.
- If the CMake script does not use the dependency in any obvious way (i.e. calls find_package purely for side-effects), then the dependency should be required as well. Note that this criterion is ambiguous: it may well be that the dependency is not needed at all.
Edited by Hadrien Benjamin Grasland