summaryrefslogtreecommitdiffstats
path: root/Modules/FeatureSummary.cmake
diff options
context:
space:
mode:
authorDaniele E. Domenichelli <ddomenichelli@drdanz.it>2017-01-26 07:57:05 (GMT)
committerDaniele E. Domenichelli <ddomenichelli@drdanz.it>2017-01-26 09:50:47 (GMT)
commit614a97a57b65454a14231ed60346884bab2399be (patch)
tree69e3e876193533f004d095a159033ec5239c3192 /Modules/FeatureSummary.cmake
parent65a0bfd83cc47e60b9f42262f762c676fb210aa2 (diff)
downloadCMake-614a97a57b65454a14231ed60346884bab2399be.zip
CMake-614a97a57b65454a14231ed60346884bab2399be.tar.gz
CMake-614a97a57b65454a14231ed60346884bab2399be.tar.bz2
FeatureSummary: Do not force OPTIONAL type in SET_PACKAGE_PROPERTIES
The OPTIONAL type is used anyway as default when the type is not set Since RUNTIME < OPTIONAL, forcing it here forces the user to set "RUNTIME" at the first SET_PACKAGE_PROPERTIES, otherwise it is impossible to set it later. Without this it is impossible, for example, to add package information (URL and DESCRIPTION) in the FindPackage file, but allow the package to be RUNTIME.
Diffstat (limited to 'Modules/FeatureSummary.cmake')
-rw-r--r--Modules/FeatureSummary.cmake30
1 files changed, 14 insertions, 16 deletions
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 80589f1..11ed170 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -439,24 +439,22 @@ function(SET_PACKAGE_PROPERTIES _name _props)
endif()
# handle the TYPE
- if(NOT _SPP_TYPE)
- set(_SPP_TYPE OPTIONAL)
- endif()
-
- # 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()
+ if(DEFINED _SPP_TYPE)
+ # 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()
- get_property(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE)
- list(FIND validTypes "${_previousType}" _prevTypeIndexInList)
+ 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}" )
+ # 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()
endif()
endfunction()