find_package()
has the flag REQUIRED
. If it is set, the configuration fails when the package cannot be found.
I think this flag should be available for all find_* functions. This reduces duplicate code like
find_program(MYEXE myexe)
if(NOT MYEXE)
status(FATAL_ERROR "myexe has not been found")
endif()
Additionally, the variable <VAR>_FOUND
should be set in each find_* function so the error handling code for is the same for optional find_program()
and optional find_package()
.
What do you think?