summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniele E. Domenichelli <ddomenichelli@drdanz.it>2017-01-25 08:34:45 (GMT)
committerDaniele E. Domenichelli <ddomenichelli@drdanz.it>2017-01-26 11:28:12 (GMT)
commit3cfde818354a8f8e26a9b0b6589f3cc38b50e48d (patch)
tree0ed96321ae86471390ee0a41d2cc416da3d92c0c
parentf0165eb624403c26989d1039c076d61536cc3074 (diff)
downloadCMake-3cfde818354a8f8e26a9b0b6589f3cc38b50e48d.zip
CMake-3cfde818354a8f8e26a9b0b6589f3cc38b50e48d.tar.gz
CMake-3cfde818354a8f8e26a9b0b6589f3cc38b50e48d.tar.bz2
FeatureSummary: Refactor to use global properties for package types
These new global properties were added: * FeatureSummary_PKG_TYPES: Package types accepted by FeatureSummary (default REQUIRED RECOMMENDED OPTIONAL RUNTIME). * FeatureSummary_REQUIRED_PKG_TYPES: Package types that will cause FeatureSummary to abort when called with FATAL_ON_MISSING_REQUIRED_PACKAGES and a package in these categories is missing (default REQUIRED). * FeatureSummary_DEFAULT_PKG_TYPE: Default package type assigned when not explicitly assigned by the user (default OPTIONAL). This allows to add and remove new package types that can be printed selectively using the "WHAT" argument.
-rw-r--r--Modules/FeatureSummary.cmake241
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt1
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt9
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake8
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt1
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt6
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt17
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake16
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt1
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt6
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt17
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake16
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt1
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt6
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt17
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake16
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt29
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake36
-rw-r--r--Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake5
19 files changed, 379 insertions, 70 deletions
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 490c956..8910be7 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -21,23 +21,86 @@ packages and/or feature for a build tree such as::
* Enables macros in MyWordProcessor
Foo, Foo provides cool stuff.
+Global Properties
+^^^^^^^^^^^^^^^^^
+
+.. variable:: FeatureSummary_PKG_TYPES
+
+The global property :variable:`FeatureSummary_PKG_TYPES` defines the type of
+packages used by `FeatureSummary`.
+
+The order in this list is important, the first package type in the list is the
+least important, the last is the most important. the of a package can only be
+changed to higher types.
+
+The default package types are , ``RUNTIME``, ``OPTIONAL``, ``RECOMMENDED`` and
+``REQUIRED``, and their importance is
+``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``.
+
+
+.. variable:: FeatureSummary_REQUIRED_PKG_TYPES
+
+The global property :variable:`FeatureSummary_REQUIRED_PKG_TYPES` defines which
+package types are required.
+
+If one or more package in this categories has not been found, CMake will abort
+when calling :cmd;`feature_summary` with the
+'FATAL_ON_MISSING_REQUIRED_PACKAGES' option enabled.
+
+The default value for this global property is ``REQUIRED``.
+
+
+.. variable:: FeatureSummary_DEFAULT_PKG_TYPE
+
+The global property :variable:`FeatureSummary_DEFAULT_PKG_TYPE` defines which
+package type is the default one.
+When calling :cmd;`feature_summary`, if the user did not set the package type
+explicitly, the package will be assigned to this category.
+
+This value must be one of the types defined in the
+:variable:`FeatureSummary_PKG_TYPES` global property unless the package type
+is set for all the packages.
+
+The default value for this global property is ``OPTIONAL``.
+
+#]=======================================================================]
+
+get_property(_fsPkgTypeIsSet GLOBAL PROPERTY FeatureSummary_PKG_TYPES SET)
+if(NOT _fsPkgTypeIsSet)
+ set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES RUNTIME OPTIONAL RECOMMENDED REQUIRED)
+endif()
+
+get_property(_fsReqPkgTypesIsSet GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES SET)
+if(NOT _fsReqPkgTypesIsSet)
+ set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES REQUIRED)
+endif()
+
+get_property(_fsDefaultPkgTypeIsSet GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE SET)
+if(NOT _fsDefaultPkgTypeIsSet)
+ set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE OPTIONAL)
+endif()
+
+#[=======================================================================[.rst:
+
Functions
^^^^^^^^^
#]=======================================================================]
+include(CMakeParseArguments)
+
function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
+ get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
+ get_property(_fsDefaultPkgType GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE)
+
set(_type "ANY")
- if("${_property}" MATCHES "REQUIRED_")
- set(_type "REQUIRED")
- elseif("${_property}" MATCHES "RECOMMENDED_")
- set(_type "RECOMMENDED")
- elseif("${_property}" MATCHES "RUNTIME_")
- set(_type "RUNTIME")
- elseif("${_property}" MATCHES "OPTIONAL_")
- set(_type "OPTIONAL")
- endif()
+ foreach(_fsPkgType ${_fsPkgTypes})
+ if("${_property}" MATCHES "${_fsPkgType}_PACKAGES_(NOT_)?FOUND")
+ set(_type "${_fsPkgType}")
+ break()
+ endif()
+ endforeach()
if("${_property}" MATCHES "PACKAGES_FOUND")
set(_property "PACKAGES_FOUND")
@@ -57,15 +120,30 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
# does this package belong to the type we currently want to list ?
get_property(_currentType GLOBAL PROPERTY _CMAKE_${_currentFeature}_TYPE)
if(NOT _currentType)
- set(_currentType OPTIONAL)
+ list(FIND _fsPkgTypes "${_fsDefaultPkgType}" _defaultInPkgTypes)
+ if("${_defaultInPkgTypes}" STREQUAL "-1")
+ string(REGEX REPLACE ";([^;]+)$" " and \\1" _fsPkgTypes_msg "${_fsPkgTypes}")
+ string(REPLACE ";" ", " _fsPkgTypes_msg "${_fsPkgTypes_msg}")
+ message(FATAL_ERROR "Bad package property type ${_fsDefaultPkgType} used in global property FeatureSummary_DEFAULT_PKG_TYPE. "
+ "Valid types are ${_fsPkgTypes_msg}. "
+ "Either update FeatureSummary_DEFAULT_PKG_TYPE or add ${_fsDefaultPkgType} to the FeatureSummary_PKG_TYPES global property.")
+ endif()
+ set(_currentType ${_fsDefaultPkgType})
endif()
if("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}")
-
# check whether the current feature/package should be in the output depending on whether it was QUIET or not
set(includeThisOne TRUE)
+ set(_required FALSE)
# skip QUIET packages, except if they are REQUIRED or INCLUDE_QUIET_PACKAGES has been set
- if((NOT "${_currentType}" STREQUAL "REQUIRED") AND NOT _includeQuiet)
+ get_property(_fsReqPkgTypes GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES)
+ foreach(_fsReqPkgType ${_fsReqPkgTypes})
+ if("${_currentType}" STREQUAL "${_fsReqPkgType}")
+ set(_required TRUE)
+ break()
+ endif()
+ endforeach()
+ if(NOT _required AND NOT _includeQuiet)
get_property(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET)
if(_isQuiet)
set(includeThisOne FALSE)
@@ -144,22 +222,15 @@ endfunction()
the list of all packages which have been found
``PACKAGES_NOT_FOUND``
the list of all packages which have not been found
- ``OPTIONAL_PACKAGES_FOUND``
- only those packages which have been found which have the type OPTIONAL
- ``OPTIONAL_PACKAGES_NOT_FOUND``
- only those packages which have not been found which have the type OPTIONAL
- ``RECOMMENDED_PACKAGES_FOUND``
- only those packages which have been found which have the type RECOMMENDED
- ``RECOMMENDED_PACKAGES_NOT_FOUND``
- only those packages which have not been found which have the type RECOMMENDED
- ``REQUIRED_PACKAGES_FOUND``
- only those packages which have been found which have the type REQUIRED
- ``REQUIRED_PACKAGES_NOT_FOUND``
- only those packages which have not been found which have the type REQUIRED
- ``RUNTIME_PACKAGES_FOUND``
- only those packages which have been found which have the type RUNTIME
- ``RUNTIME_PACKAGES_NOT_FOUND``
- only those packages which have not been found which have the type RUNTIME
+
+ For each package type ``<TYPE>`` defined by the
+ :variable:`FeatureSummary_PKG_TYPES` global property, the following
+ information can also be used:
+
+ ``<TYPE>_PACKAGES_FOUND``
+ only those packages which have been found which have the type <TYPE>
+ ``<TYPE>_PACKAGES_NOT_FOUND``
+ only those packages which have not been found which have the type <TYPE>
With the exception of the ``ALL`` value, these values can be combined
in order to customize the output. For example:
@@ -178,7 +249,15 @@ endfunction()
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
- package which is marked as ``REQUIRED`` has not been found.
+ package which is marked as one of the package types listed in the
+ :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global property has not been
+ found.
+ The default value for the :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global
+ property is ``REQUIRED``.
+
+ The :variable:`FeatureSummary_DEFAULT_PKG_TYPE` global property can be
+ modified to change the default package type assigned when not explicitly
+ assigned by the user.
If the ``QUIET_ON_EMPTY`` option is used, if only one type of package was
requested, and no packages belonging to that category were found, then no
@@ -204,6 +283,23 @@ endfunction()
DESCRIPTION "Enabled Features:"
VAR enabledFeaturesText)
message(STATUS "${enabledFeaturesText}")
+
+ Example 3, change default package types and print only the categories that
+ are not empty:
+
+ .. code-block:: cmake
+
+ include(FeatureSummary)
+ set_property(GLOBAL APPEND PROPERTY FeatureSummary_PKG_TYPES BUILD)
+ find_package(FOO)
+ set_package_properties(FOO PROPERTIES TYPE BUILD)
+ feature_summary(WHAT BUILD_PACKAGES_FOUND
+ Description "Build tools found:"
+ QUIET_ON_EMPTY)
+ feature_summary(WHAT BUILD_PACKAGES_NOT_FOUND
+ Description "Build tools not found:"
+ QUIET_ON_EMPTY)
+
#]=======================================================================]
function(FEATURE_SUMMARY)
@@ -225,15 +321,14 @@ function(FEATURE_SUMMARY)
set(validWhatParts "ENABLED_FEATURES"
"DISABLED_FEATURES"
"PACKAGES_FOUND"
- "PACKAGES_NOT_FOUND"
- "OPTIONAL_PACKAGES_FOUND"
- "OPTIONAL_PACKAGES_NOT_FOUND"
- "RECOMMENDED_PACKAGES_FOUND"
- "RECOMMENDED_PACKAGES_NOT_FOUND"
- "REQUIRED_PACKAGES_FOUND"
- "REQUIRED_PACKAGES_NOT_FOUND"
- "RUNTIME_PACKAGES_FOUND"
- "RUNTIME_PACKAGES_NOT_FOUND")
+ "PACKAGES_NOT_FOUND")
+
+ get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
+ get_property(_fsReqPkgTypes GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES)
+ foreach(_fsPkgType ${_fsPkgTypes})
+ list(APPEND validWhatParts "${_fsPkgType}_PACKAGES_FOUND"
+ "${_fsPkgType}_PACKAGES_NOT_FOUND")
+ endforeach()
list(FIND validWhatParts "${_FS_WHAT}" indexInList)
if(NOT "${indexInList}" STREQUAL "-1")
@@ -241,26 +336,27 @@ function(FEATURE_SUMMARY)
if(_featureSummary OR NOT _FS_QUIET_ON_EMPTY)
set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
endif()
- if (("${_FS_WHAT}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") AND _featureSummary)
- set(requiredPackagesNotFound TRUE)
+
+ if(_featureSummary)
+ foreach(_fsReqPkgType ${_fsReqPkgTypes})
+ if("${_FS_WHAT}" STREQUAL "${_fsReqPkgType}_PACKAGES_NOT_FOUND")
+ set(requiredPackagesNotFound TRUE)
+ break()
+ endif()
+ endforeach()
endif()
else()
if("${_FS_WHAT}" STREQUAL "ALL")
- set(allWhatParts "ENABLED_FEATURES"
- "RUNTIME_PACKAGES_FOUND"
- "OPTIONAL_PACKAGES_FOUND"
- "RECOMMENDED_PACKAGES_FOUND"
- "REQUIRED_PACKAGES_FOUND"
-
- "DISABLED_FEATURES"
- "RUNTIME_PACKAGES_NOT_FOUND"
- "OPTIONAL_PACKAGES_NOT_FOUND"
- "RECOMMENDED_PACKAGES_NOT_FOUND"
- "REQUIRED_PACKAGES_NOT_FOUND"
- )
-
+ set(allWhatParts "ENABLED_FEATURES")
+ foreach(_fsPkgType ${_fsPkgTypes})
+ list(APPEND allWhatParts "${_fsPkgType}_PACKAGES_FOUND")
+ endforeach()
+ list(APPEND allWhatParts "DISABLED_FEATURES")
+ foreach(_fsPkgType ${_fsPkgTypes})
+ list(APPEND allWhatParts "${_fsPkgType}_PACKAGES_NOT_FOUND")
+ endforeach()
else()
set(allWhatParts)
foreach(part ${_FS_WHAT})
@@ -281,14 +377,10 @@ function(FEATURE_SUMMARY)
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:")
- set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:")
- set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:")
- set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:")
- set(title_RECOMMENDED_PACKAGES_NOT_FOUND "The following RECOMMENDED packages have not been found:")
- set(title_REQUIRED_PACKAGES_FOUND "The following REQUIRED packages have been found:")
- set(title_REQUIRED_PACKAGES_NOT_FOUND "The following REQUIRED packages have not been found:")
- set(title_RUNTIME_PACKAGES_FOUND "The following RUNTIME packages have been found:")
- set(title_RUNTIME_PACKAGES_NOT_FOUND "The following RUNTIME 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})
@@ -299,9 +391,12 @@ function(FEATURE_SUMMARY)
string(APPEND _fullText "\n-- ")
endif()
string(APPEND _fullText "${title_${part}}\n${_tmp}\n")
- if("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND")
- set(requiredPackagesNotFound TRUE)
- endif()
+ foreach(_fsReqPkgType ${_fsReqPkgTypes})
+ if("${part}" STREQUAL "${_fsReqPkgType}_PACKAGES_NOT_FOUND")
+ set(requiredPackagesNotFound TRUE)
+ break()
+ endif()
+ endforeach()
endif()
endforeach()
endif()
@@ -375,7 +470,8 @@ endfunction()
TYPEs (``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``), lower TYPEs are
ignored. The ``TYPE`` property is project-specific, so it cannot be set
by the Find-module, but must be set in the project.
-
+ Type accepted can be changed by setting the
+ :variable:`FeatureSummary_PKG_TYPES` global property.
``PURPOSE <purpose>``
This describes which features this package enables in the
@@ -448,18 +544,23 @@ function(SET_PACKAGE_PROPERTIES _name _props)
set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_SPP_PURPOSE}" )
endif()
+ get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
+ get_property(_fsDefaultPkgType GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE)
+
# handle the TYPE
if(DEFINED _SPP_TYPE)
- # List the supported types, according to their priority
- set(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" )
- list(FIND validTypes ${_SPP_TYPE} _typeIndexInList)
+ # Supported types are listed in FeatureSummary_PKG_TYPES according to their priority
+ get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
+ list(FIND _fsPkgTypes ${_SPP_TYPE} _typeIndexInList)
if("${_typeIndexInList}" STREQUAL "-1" )
+ string(REGEX REPLACE ";([^;]+)$" " and \\1" _fsPkgTypes_msg "${_fsPkgTypes}")
+ string(REPLACE ";" ", " _fsPkgTypes_msg "${_fsPkgTypes_msg}")
message(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). "
- "Valid types are OPTIONAL, RECOMMENDED, REQUIRED and RUNTIME." )
+ "Valid types are ${_fsPkgTypes_msg}." )
endif()
get_property(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE)
- list(FIND validTypes "${_previousType}" _prevTypeIndexInList)
+ list(FIND _fsPkgTypes "${_previousType}" _prevTypeIndexInList)
# make sure a previously set TYPE is not overridden with a lower new TYPE:
if("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}")
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt
new file mode 100644
index 0000000..58f6125
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
+ Bad package property type OPTIONAL used in global property
+ FeatureSummary_DEFAULT_PKG_TYPE. Valid types are TYPE1, TYPE2 and TYPE3.
+ Either update FeatureSummary_DEFAULT_PKG_TYPE or add OPTIONAL to the
+ FeatureSummary_PKG_TYPES global property.
+Call Stack \(most recent call first\):
+ .*/Modules/FeatureSummary\.cmake:[0-9]+. \(_FS_GET_FEATURE_SUMMARY\)
+ FeatureSummaryCustomBadDefault.cmake:[0-9]+ \(feature_summary\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake
new file mode 100644
index 0000000..7e2fd55
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake
@@ -0,0 +1,8 @@
+include(FeatureSummary)
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+find_package(Foo)
+
+feature_summary(WHAT ALL)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt
new file mode 100644
index 0000000..e37b9f5
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
+ feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake
+ run.
+Call Stack \(most recent call first\):
+ FeatureSummaryCustomRequired.cmake:[0-9]+ \(feature_summary\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt
new file mode 100644
index 0000000..ecca71f
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt
@@ -0,0 +1,17 @@
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE2 packages have not been found:
+
+ \* Bar
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have not been found:
+
+ \* Bar
+
+-- Configuring incomplete, errors occurred!
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake
new file mode 100644
index 0000000..11cf04c
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake
@@ -0,0 +1,16 @@
+include(FeatureSummary)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE2)
+
+find_package(Foo)
+find_package(Bar)
+
+set_package_properties(Foo PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
+
+set_package_properties(Bar PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt
new file mode 100644
index 0000000..c9d8b4b
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
+ feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake
+ run.
+Call Stack \(most recent call first\):
+ FeatureSummaryCustomRequiredListA.cmake:[0-9]+ \(feature_summary\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt
new file mode 100644
index 0000000..b12d53a
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt
@@ -0,0 +1,17 @@
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE1 packages have not been found:
+
+ \* Bar
+
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE2 packages have not been found:
+
+ \* Bar
+
+-- Configuring incomplete, errors occurred!
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake
new file mode 100644
index 0000000..53111be
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake
@@ -0,0 +1,16 @@
+include(FeatureSummary)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE1)
+
+find_package(Foo)
+find_package(Bar)
+
+set_package_properties(Foo PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
+
+set_package_properties(Bar PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt
new file mode 100644
index 0000000..8ef7a8d
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
+ feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake
+ run.
+Call Stack \(most recent call first\):
+ FeatureSummaryCustomRequiredListB.cmake:[0-9]+ \(feature_summary\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt
new file mode 100644
index 0000000..5f07173
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt
@@ -0,0 +1,17 @@
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE1 packages have not been found:
+
+ \* Bar
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have not been found:
+
+ \* Bar
+
+-- Configuring incomplete, errors occurred!
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake
new file mode 100644
index 0000000..526b979
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake
@@ -0,0 +1,16 @@
+include(FeatureSummary)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE1)
+
+find_package(Foo)
+find_package(Bar)
+
+set_package_properties(Foo PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
+
+set_package_properties(Bar PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt
new file mode 100644
index 0000000..a7f973b
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt
@@ -0,0 +1,29 @@
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE1 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- Configuring done
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake
new file mode 100644
index 0000000..34b0c1f
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake
@@ -0,0 +1,36 @@
+include(FeatureSummary)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE2)
+
+find_package(Foo)
+
+# Type not set => TYPE2
+feature_summary(WHAT ALL)
+
+# TYPE1 > not set => TYPE1
+set_package_properties(Foo PROPERTIES TYPE TYPE1)
+feature_summary(WHAT ALL)
+
+# TYPE2 > TYPE1 => TYPE2
+set_package_properties(Foo PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL)
+
+# TYPE1 < TYPE2 => TYPE2
+set_package_properties(Foo PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL)
+
+# TYPE3 > TYPE2 => TYPE3
+set_package_properties(Foo PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL)
+
+# TYPE2 < TYPE3 => TYPE3
+set_package_properties(Foo PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL)
+
+# TYPE1 < TYPE3 => TYPE3
+set_package_properties(Foo PROPERTIES TYPE TYPE1)
+feature_summary(WHAT ALL)
diff --git a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake
index 97c23f9..9caee4c 100644
--- a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake
@@ -14,3 +14,8 @@ run_cmake(FeatureSummaryFatalOnMissingRequiredPackages)
run_cmake(FeatureSummaryIncludeQuietPackages)
run_cmake(FeatureSummaryQuietOnEmpty)
run_cmake(FeatureSummaryMultipleDepends)
+run_cmake(FeatureSummaryCustomTypes)
+run_cmake(FeatureSummaryCustomBadDefault)
+run_cmake(FeatureSummaryCustomRequired)
+run_cmake(FeatureSummaryCustomRequiredListA)
+run_cmake(FeatureSummaryCustomRequiredListB)