diff options
Diffstat (limited to 'cmake/scripts/common/Macros.cmake')
-rw-r--r-- | cmake/scripts/common/Macros.cmake | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake index 6846ab00ac..19b2b506d0 100644 --- a/cmake/scripts/common/Macros.cmake +++ b/cmake/scripts/common/Macros.cmake @@ -358,6 +358,7 @@ function(core_optional_dep dep) find_package(${dep}) elseif(${${enable_switch}}) find_package(${dep} REQUIRED) + set(_required True) endif() if(${depup}_FOUND) @@ -366,6 +367,8 @@ function(core_optional_dep dep) list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) export_dep() + elseif(_required) + message(FATAL_ERROR "${depup} enabled but not found") else() set(final_message ${final_message} "${depup} enabled: No" PARENT_SCOPE) endif() @@ -378,16 +381,24 @@ endfunction() # dependency optionally added to ${SYSTEM_INCLUDES}, ${DEP_DEFINES}, ${dep}_SONAME is set up function(core_optional_dyload_dep dep) setup_enable_switch() - if(${enable_switch}) + if(${enable_switch} STREQUAL AUTO) find_package(${dep}) - if(${depup}_FOUND) - list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) - find_soname(${depup} REQUIRED) - list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) - set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) - export_dep() - set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) - endif() + elseif(${${enable_switch}}) + find_package(${dep} REQUIRED) + set(_required True) + endif() + + if(${depup}_FOUND) + list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) + find_soname(${depup} REQUIRED) + list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) + set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) + export_dep() + set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) + elseif(_required) + message(FATAL_ERROR "${depup} enabled but not found") + else() + set(final_message ${final_message} "${depup} enabled: No" PARENT_SCOPE) endif() endfunction() |