Commit 02d47abe authored by Alexander Neundorf's avatar Alexander Neundorf

FeatureSummary.cmake: error out when a REQUIRED package is missing

Alex
parent 91a15277
...@@ -240,7 +240,8 @@ FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet) ...@@ -240,7 +240,8 @@ FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
# check whether the current feature/package should be in the output depending on whether it was QUIET or not # check whether the current feature/package should be in the output depending on whether it was QUIET or not
SET(includeThisOne TRUE) SET(includeThisOne TRUE)
IF(NOT _includeQuiet) # skip QUIET packages, except if they are REQUIRED or INCLUDE_QUIET_PACKAGES has been set
IF((NOT "${_currentType}" STREQUAL "REQUIRED") AND NOT _includeQuiet)
GET_PROPERTY(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET) GET_PROPERTY(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET)
IF(_isQuiet) IF(_isQuiet)
SET(includeThisOne FALSE) SET(includeThisOne FALSE)
...@@ -290,7 +291,7 @@ ENDFUNCTION(PRINT_DISABLED_FEATURES) ...@@ -290,7 +291,7 @@ ENDFUNCTION(PRINT_DISABLED_FEATURES)
FUNCTION(FEATURE_SUMMARY) FUNCTION(FEATURE_SUMMARY)
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) # CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
SET(options APPEND INCLUDE_QUIET_PACKAGES ) SET(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
SET(oneValueArgs FILENAME VAR DESCRIPTION WHAT) SET(oneValueArgs FILENAME VAR DESCRIPTION WHAT)
SET(multiValueArgs ) # none SET(multiValueArgs ) # none
...@@ -321,6 +322,10 @@ FUNCTION(FEATURE_SUMMARY) ...@@ -321,6 +322,10 @@ FUNCTION(FEATURE_SUMMARY)
IF(NOT "${indexInList}" STREQUAL "-1") IF(NOT "${indexInList}" STREQUAL "-1")
_FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} ) _FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} )
SET(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n") SET(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
IF (("${_FS_WHAT}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") AND _featureSummary)
SET(requiredPackagesNotFound TRUE)
ENDIF()
ELSEIF("${_FS_WHAT}" STREQUAL "ALL") ELSEIF("${_FS_WHAT}" STREQUAL "ALL")
SET(allWhatParts "ENABLED_FEATURES" SET(allWhatParts "ENABLED_FEATURES"
...@@ -347,12 +352,15 @@ FUNCTION(FEATURE_SUMMARY) ...@@ -347,12 +352,15 @@ FUNCTION(FEATURE_SUMMARY)
SET(title_RUNTIME_PACKAGES_FOUND "The following RUNTIME packages have been found:") SET(title_RUNTIME_PACKAGES_FOUND "The following RUNTIME packages have been found:")
SET(title_RUNTIME_PACKAGES_NOT_FOUND "The following RUNTIME packages have not been found:") SET(title_RUNTIME_PACKAGES_NOT_FOUND "The following RUNTIME packages have not been found:")
SET(_fullText "${_FS_DESCRIPTION}\n") SET(_fullText "${_FS_DESCRIPTION}")
FOREACH(part ${allWhatParts}) FOREACH(part ${allWhatParts})
SET(_tmp) SET(_tmp)
_FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES}) _FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES})
IF(_tmp) IF(_tmp)
SET(_fullText "${_fullText}\n${title_${part}}\n${_tmp}") SET(_fullText "${_fullText}\n\n${title_${part}}\n${_tmp}")
IF("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND")
SET(requiredPackagesNotFound TRUE)
ENDIF()
ENDIF() ENDIF()
ENDFOREACH() ENDFOREACH()
ELSE() ELSE()
...@@ -376,4 +384,8 @@ FUNCTION(FEATURE_SUMMARY) ...@@ -376,4 +384,8 @@ FUNCTION(FEATURE_SUMMARY)
SET(${_FS_VAR} "${_fullText}" PARENT_SCOPE) SET(${_FS_VAR} "${_fullText}" PARENT_SCOPE)
ENDIF(_FS_VAR) ENDIF(_FS_VAR)
IF(requiredPackagesNotFound AND _FS_FATAL_ON_MISSING_REQUIRED_PACKAGES)
MESSAGE(FATAL_ERROR "feature_summary() Error: REQUIRED package(s) are missing, aborting CMake run.")
ENDIF()
ENDFUNCTION(FEATURE_SUMMARY) ENDFUNCTION(FEATURE_SUMMARY)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment