diff options
author | Alex Neundorf <neundorf@kde.org> | 2011-07-17 18:41:09 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2011-07-17 18:41:09 (GMT) |
commit | f407bb5da29b36ca4edee93ff21ae2a5b8fda960 (patch) | |
tree | 32a1e9064d53f4b6c9590ba5f9739d5fd6a092cd /Modules | |
parent | 02d47abe58b4fa99f34b24cb799084e0f57215bd (diff) | |
download | CMake-f407bb5da29b36ca4edee93ff21ae2a5b8fda960.zip CMake-f407bb5da29b36ca4edee93ff21ae2a5b8fda960.tar.gz CMake-f407bb5da29b36ca4edee93ff21ae2a5b8fda960.tar.bz2 |
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')
-rw-r--r-- | Modules/FeatureSummary.cmake | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index ff14571..866b300 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) |