aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorwsnipex <wsnipex@a1.net>2016-12-19 09:46:31 +0100
committerwsnipex <wsnipex@a1.net>2016-12-22 11:09:20 +0100
commit198200b8b4732eddc5eb1fb5f781827f047bcabc (patch)
treecd4174db6e6187aa799e88b54ce593d363c122f5 /cmake
parentc4da9e834abc7e4a208e818e7390d8d1283f6ee7 (diff)
[cmake] fail when optional deps were manually enabled, but not found
Diffstat (limited to 'cmake')
-rw-r--r--cmake/scripts/common/Macros.cmake29
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()