[CMake] find_feature unset RECOMMENDED

If a feature with status RECOMMENDED is not detected, unset the
WITH_FEATURE flag.
This commit is contained in:
Armin Novak 2023-03-11 12:16:59 +01:00 committed by Martin Fleisz
parent 6bf42366a9
commit 5826a4ae11

View File

@ -24,6 +24,10 @@ macro(find_feature _feature _type _purpose _description)
message(STATUS "Finding ${_type_lower} feature ${_feature} for ${_purpose} (${_description})")
message(STATUS " Disable feature ${_feature} using \"-DWITH_${_feature_upper}=OFF\"")
find_package(${_feature})
if (NOT ${_feature}_FOUND)
set(_feature_default "OFF")
message(STATUS "Not detected ${_type_lower} feature ${_feature} for ${_purpose} (${_description}), feature disabled")
endif()
endif()
elseif(${_type} STREQUAL "OPTIONAL")
if(${WITH_${_feature_upper}})