Files
CMake/Tests/RunCMake/find_file/Optional.cmake
T
Martin Duffy 857a039d66 find_*: Add variable to default calls to REQUIRED
This adds a `CMAKE_FIND_REQUIRED` variable which causes `find_package`,
`find_path`, `find_file`, `find_library` and `find_program` to be
considered `REQUIRED` by default.

It also introduces an `OPTIONAL` keyword to those commands, allowing
them to ignore the value of this variable.

Issue: #26576
2025-02-27 10:51:07 -05:00

15 lines
251 B
CMake

set(CMAKE_FIND_REQUIRED ON)
find_file(FILE_doNotExists_Optional
NAMES doNotExists.h
OPTIONAL
)
find_file(FILE_doNotExists_OptionalRequired
NAMES doNotExists.h
OPTIONAL
REQUIRED
)
find_file(FILE_doNotExists
NAMES doNotExists.h
REQUIRED
)