summaryrefslogtreecommitdiff
path: root/Modules/FeatureSummary.cmake
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-07-17 20:41:09 +0200
committerAlex Neundorf <neundorf@kde.org>2011-07-17 20:41:09 +0200
commitf407bb5da29b36ca4edee93ff21ae2a5b8fda960 (patch)
tree32a1e9064d53f4b6c9590ba5f9739d5fd6a092cd /Modules/FeatureSummary.cmake
parent02d47abe58b4fa99f34b24cb799084e0f57215bd (diff)
downloadcmake-f407bb5da29b36ca4edee93ff21ae2a5b8fda960.tar.gz
FeatureSummary.cmake: only higher TYPEs can override previous TYPEs
This way e.g. a REQUIRED cannot become OPTIONAL, only the other way round Alex
Diffstat (limited to 'Modules/FeatureSummary.cmake')
-rw-r--r--Modules/FeatureSummary.cmake11
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index ff14571289..866b300324 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -192,14 +192,21 @@ FUNCTION(SET_PACKAGE_PROPERTIES _name _props)
SET(_SPP_TYPE OPTIONAL)
ENDIF()
- SET(validTypes OPTIONAL RECOMMENDED REQUIRED RUNTIME )
+ # List the supported types, according to their priority
+ SET(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" )
LIST(FIND validTypes ${_SPP_TYPE} _typeIndexInList)
IF("${_typeIndexInList}" STREQUAL "-1" )
MESSAGE(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). "
"Valid types are OPTIONAL, RECOMMENDED, REQUIRED and RUNTIME." )
ENDIF()
- SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" )
+ GET_PROPERTY(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE)
+ LIST(FIND validTypes "${_previousType}" _prevTypeIndexInList)
+
+ # make sure a previously set TYPE is not overridden with a lower new TYPE:
+ IF("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}")
+ SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" )
+ ENDIF()
ENDFUNCTION(SET_PACKAGE_PROPERTIES)