Feature request: REQUIRED for all find_* functions

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?

1 Like

@sjoubert recently implemented this in CMake MR 4435 and will be in CMake 3.18.

1 Like

Nice. What a coincidence! :slight_smile: