summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-02-07 14:59:41 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2017-02-07 14:59:41 (GMT)
commitc756ad9e73e1432d8596caf7dd6ade298ce84946 (patch)
tree8cb39dc416de1248fbf9514da4d1f417be069396 /Modules
parent4dbd03f6ef60a88e76b4a716782fb186c19fd6d6 (diff)
parent28e87033a3f3f997334c45b19b2292ed3821f59e (diff)
downloadCMake-c756ad9e73e1432d8596caf7dd6ade298ce84946.zip
CMake-c756ad9e73e1432d8596caf7dd6ade298ce84946.tar.gz
CMake-c756ad9e73e1432d8596caf7dd6ade298ce84946.tar.bz2
Merge topic 'FeatureSummary_description'
28e87033 FeatureSummary: Update release notes 6f62c66b FeatureSummary: Add FeatureSummary_<TYPE>_DESCRIPTION global properties f9bc8cfe FeatureSummary: Add DEFAULT_DESCRIPTION option to feature_summary
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FeatureSummary.cmake61
1 files changed, 47 insertions, 14 deletions
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index f29a5f0..1b93304 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -63,6 +63,16 @@ is set for all the packages.
The default value for this global property is ``OPTIONAL``.
+
+.. variable:: FeatureSummary_<TYPE>_DESCRIPTION
+
+The global property :variable:`FeatureSummary_<TYPE>_DESCRIPTION` can be defined
+for each type to replace the type name with the specified string whenever the
+package type is used in an output string.
+
+If not set, the string "``<TYPE>`` packages" is used.
+
+
#]=======================================================================]
get_property(_fsPkgTypeIsSet GLOBAL PROPERTY FeatureSummary_PKG_TYPES SET)
@@ -196,7 +206,7 @@ endfunction()
[VAR <variable_name>]
[INCLUDE_QUIET_PACKAGES]
[FATAL_ON_MISSING_REQUIRED_PACKAGES]
- [DESCRIPTION "<description>"]
+ [DESCRIPTION "<description>" | DEFAULT_DESCRIPTION]
[QUIET_ON_EMPTY]
WHAT (ALL
| PACKAGES_FOUND | PACKAGES_NOT_FOUND
@@ -247,7 +257,10 @@ endfunction()
information is "printed" into the specified variable. If ``FILENAME`` is
not used, the information is printed to the terminal. Using the
``DESCRIPTION`` option a description or headline can be set which will be
- printed above the actual content.
+ printed above the actual content. If only one type of
+ package was requested, no title is printed, unless it is explicitly set using
+ either ``DESCRIPTION`` to use a custom string, or ``DEFAULT_DESCRIPTION`` to
+ use a default title for the requested type.
If ``INCLUDE_QUIET_PACKAGES`` is given, packages which have been searched with
``find_package(... QUIET)`` will also be listed. By default they are skipped.
If ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` is given, CMake will abort if a
@@ -306,8 +319,14 @@ endfunction()
function(FEATURE_SUMMARY)
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
- set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES QUIET_ON_EMPTY)
- set(oneValueArgs FILENAME VAR DESCRIPTION)
+ set(options APPEND
+ INCLUDE_QUIET_PACKAGES
+ FATAL_ON_MISSING_REQUIRED_PACKAGES
+ QUIET_ON_EMPTY
+ DEFAULT_DESCRIPTION)
+ set(oneValueArgs FILENAME
+ VAR
+ DESCRIPTION)
set(multiValueArgs WHAT)
CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
@@ -320,6 +339,11 @@ function(FEATURE_SUMMARY)
message(FATAL_ERROR "The call to FEATURE_SUMMARY() doesn't set the required WHAT argument.")
endif()
+ if(_FS_DEFAULT_DESCRIPTION AND DEFINED _FS_DESCRIPTION)
+ message(WARNING "DEFAULT_DESCRIPTION option discarded since DESCRIPTION is set.")
+ set(_FS_DEFAULT_DESCRIPTION 0)
+ endif()
+
set(validWhatParts "ENABLED_FEATURES"
"DISABLED_FEATURES"
"PACKAGES_FOUND"
@@ -332,11 +356,29 @@ function(FEATURE_SUMMARY)
"${_fsPkgType}_PACKAGES_NOT_FOUND")
endforeach()
+ set(title_ENABLED_FEATURES "The following features have been enabled:")
+ set(title_DISABLED_FEATURES "The following features have been disabled:")
+ set(title_PACKAGES_FOUND "The following packages have been found:")
+ set(title_PACKAGES_NOT_FOUND "The following packages have not been found:")
+ foreach(_fsPkgType ${_fsPkgTypes})
+ set(_fsPkgTypeDescription "${_fsPkgType} packages")
+ get_property(_fsPkgTypeDescriptionIsSet GLOBAL PROPERTY FeatureSummary_${_fsPkgType}_DESCRIPTION SET)
+ if(_fsPkgTypeDescriptionIsSet)
+ get_property(_fsPkgTypeDescription GLOBAL PROPERTY FeatureSummary_${_fsPkgType}_DESCRIPTION )
+ endif()
+ set(title_${_fsPkgType}_PACKAGES_FOUND "The following ${_fsPkgTypeDescription} have been found:")
+ set(title_${_fsPkgType}_PACKAGES_NOT_FOUND "The following ${_fsPkgTypeDescription} have not been found:")
+ endforeach()
+
list(FIND validWhatParts "${_FS_WHAT}" indexInList)
if(NOT "${indexInList}" STREQUAL "-1")
_FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} )
if(_featureSummary OR NOT _FS_QUIET_ON_EMPTY)
- set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
+ if(_FS_DEFAULT_DESCRIPTION)
+ set(_fullText "${title_${_FS_WHAT}}\n${_featureSummary}\n")
+ else()
+ set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
+ endif()
endif()
if(_featureSummary)
@@ -375,15 +417,6 @@ function(FEATURE_SUMMARY)
endforeach()
endif()
- set(title_ENABLED_FEATURES "The following features have been enabled:")
- set(title_DISABLED_FEATURES "The following features have been disabled:")
- set(title_PACKAGES_FOUND "The following packages have been found:")
- set(title_PACKAGES_NOT_FOUND "The following packages have not been found:")
- foreach(_fsPkgType ${_fsPkgTypes})
- set(title_${_fsPkgType}_PACKAGES_FOUND "The following ${_fsPkgType} packages have been found:")
- set(title_${_fsPkgType}_PACKAGES_NOT_FOUND "The following ${_fsPkgType} packages have not been found:")
- endforeach()
-
set(_fullText "${_FS_DESCRIPTION}")
foreach(part ${allWhatParts})
set(_tmp)