FeatureSummary.cmake: add INCLUDE_QUIET_PACKAGES keyword

Now found packages are not stored in ENABLED/DISABLED_FEATURES
anymore, but always in PACKAGES_FOUND/NOT_FOUND.
ENABLED/DISABLED_FEATURES is now only used via
ADD_FEATURE_INFO(), e.g. for stuff set via option().

Alex
This commit is contained in:
Alex Neundorf 2011-07-17 17:48:00 +02:00
parent 0671a02920
commit 91a1527735
2 changed files with 45 additions and 33 deletions

View File

@ -19,6 +19,7 @@
# FEATURE_SUMMARY( [FILENAME <file>] # FEATURE_SUMMARY( [FILENAME <file>]
# [APPEND] # [APPEND]
# [VAR <variable_name>] # [VAR <variable_name>]
# [INCLUDE_QUIET_PACKAGES]
# [DESCRIPTION "Found packages:"] # [DESCRIPTION "Found packages:"]
# WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND # WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND
# | ENABLED_FEATURES | DISABLED_FEATURES] # | ENABLED_FEATURES | DISABLED_FEATURES]
@ -32,10 +33,8 @@
# #
# The WHAT option is the only mandatory option. Here you specify what information # The WHAT option is the only mandatory option. Here you specify what information
# will be printed: # will be printed:
# ENABLED_FEATURES: the list of all features and packages which are enabled, # ENABLED_FEATURES: the list of all features which are enabled
# excluding the QUIET packages # DISABLED_FEATURES: the list of all features which are disabled
# DISABLED_FEATURES: the list of all features and packages which are disabled,
# excluding the QUIET packages
# PACKAGES_FOUND: the list of all packages which have been found # PACKAGES_FOUND: the list of all packages which have been found
# PACKAGES_NOT_FOUND: the list of all packages which have not been found # PACKAGES_NOT_FOUND: the list of all packages which have not been found
# ALL: this will give all packages which have or have not been found # ALL: this will give all packages which have or have not been found
@ -206,7 +205,7 @@ ENDFUNCTION(SET_PACKAGE_PROPERTIES)
FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var) FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
SET(_type "ANY") SET(_type "ANY")
IF("${_property}" MATCHES "REQUIRED_") IF("${_property}" MATCHES "REQUIRED_")
@ -239,24 +238,37 @@ FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var)
IF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}") IF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}")
SET(_currentFeatureText "${_currentFeatureText}\n${_currentFeature}") # check whether the current feature/package should be in the output depending on whether it was QUIET or not
GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_REQUIRED_VERSION) SET(includeThisOne TRUE)
IF(_info) IF(NOT _includeQuiet)
SET(_currentFeatureText "${_currentFeatureText} (required version ${_info})") GET_PROPERTY(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET)
ENDIF(_info) IF(_isQuiet)
GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION) SET(includeThisOne FALSE)
IF(_info) ENDIF()
SET(_currentFeatureText "${_currentFeatureText} , ${_info}") ENDIF()
ENDIF(_info)
GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL)
IF(_info)
SET(_currentFeatureText "${_currentFeatureText} , <${_info}>")
ENDIF(_info)
GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE) IF(includeThisOne)
FOREACH(_purpose ${_info})
SET(_currentFeatureText "${_currentFeatureText}\n * ${_purpose}") SET(_currentFeatureText "${_currentFeatureText}\n${_currentFeature}")
ENDFOREACH() GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_REQUIRED_VERSION)
IF(_info)
SET(_currentFeatureText "${_currentFeatureText} (required version ${_info})")
ENDIF(_info)
GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION)
IF(_info)
SET(_currentFeatureText "${_currentFeatureText} , ${_info}")
ENDIF(_info)
GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL)
IF(_info)
SET(_currentFeatureText "${_currentFeatureText} , <${_info}>")
ENDIF(_info)
GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE)
FOREACH(_purpose ${_info})
SET(_currentFeatureText "${_currentFeatureText}\n * ${_purpose}")
ENDFOREACH()
ENDIF(includeThisOne)
ENDIF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}") ENDIF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}")
@ -278,7 +290,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) SET(options APPEND INCLUDE_QUIET_PACKAGES )
SET(oneValueArgs FILENAME VAR DESCRIPTION WHAT) SET(oneValueArgs FILENAME VAR DESCRIPTION WHAT)
SET(multiValueArgs ) # none SET(multiValueArgs ) # none
@ -307,7 +319,7 @@ FUNCTION(FEATURE_SUMMARY)
LIST(FIND validWhatParts "${_FS_WHAT}" indexInList) LIST(FIND validWhatParts "${_FS_WHAT}" indexInList)
IF(NOT "${indexInList}" STREQUAL "-1") IF(NOT "${indexInList}" STREQUAL "-1")
_FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary) _FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} )
SET(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n") SET(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
ELSEIF("${_FS_WHAT}" STREQUAL "ALL") ELSEIF("${_FS_WHAT}" STREQUAL "ALL")
@ -338,7 +350,7 @@ FUNCTION(FEATURE_SUMMARY)
SET(_fullText "${_FS_DESCRIPTION}\n") SET(_fullText "${_FS_DESCRIPTION}\n")
FOREACH(part ${allWhatParts}) FOREACH(part ${allWhatParts})
SET(_tmp) SET(_tmp)
_FS_GET_FEATURE_SUMMARY( ${part} _tmp) _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${title_${part}}\n${_tmp}")
ENDIF() ENDIF()

View File

@ -1174,20 +1174,20 @@ void cmFindPackageCommand::AppendSuccessInformation()
if ((cmSystemTools::IsOn(result)) || (cmSystemTools::IsOn(upperResult))) if ((cmSystemTools::IsOn(result)) || (cmSystemTools::IsOn(upperResult)))
{ {
this->AppendToProperty("PACKAGES_FOUND"); this->AppendToProperty("PACKAGES_FOUND");
if (!this->Quiet)
{
this->AppendToProperty("ENABLED_FEATURES");
}
} }
else else
{ {
this->AppendToProperty("PACKAGES_NOT_FOUND"); this->AppendToProperty("PACKAGES_NOT_FOUND");
if (!this->Quiet)
{
this->AppendToProperty("DISABLED_FEATURES");
}
} }
// Record whether the find was quiet or not, so this can be used
// e.g. in FeatureSummary.cmake
std::string quietInfoPropName = "_CMAKE_";
quietInfoPropName += this->Name;
quietInfoPropName += "_QUIET";
this->Makefile->GetCMakeInstance()->SetProperty(quietInfoPropName.c_str(),
this->Quiet ? "TRUE" : "FALSE");
// set a global property to record the required version of this package // set a global property to record the required version of this package
std::string versionInfoPropName = "_CMAKE_"; std::string versionInfoPropName = "_CMAKE_";
versionInfoPropName += this->Name; versionInfoPropName += this->Name;