FeatureSummary: Add FeatureSummary_<TYPE>_DESCRIPTION global properties

The global property 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.
This commit is contained in:
Daniele E. Domenichelli 2017-02-03 15:42:11 +01:00 committed by Brad King
parent f9bc8cfeeb
commit 6f62c66b2c
4 changed files with 267 additions and 2 deletions

View File

@ -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)
@ -351,8 +361,13 @@ function(FEATURE_SUMMARY)
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:")
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)

View File

@ -0,0 +1,91 @@
-- The following TYPE1 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 not been found:
\* Baz
--[ ]
\* Foo, The Foo package, <https://foo.example/>
--[ ]
\* Bar
--[ ]
\* Baz
-- TYPE1 pkgs found
\* Foo, The Foo package, <https://foo.example/>
-- TYPE2 pkgs not found
\* Bar
-- TYPE3 pkgs not found
\* Baz
-- The following TYPE1 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 not been found:
\* Baz
-- The following first type packages have been found:
\* Foo, The Foo package, <https://foo.example/>
-- The following second type packages have not been found:
\* Bar
-- The following third type packages have not been found:
\* Baz
--[ ]
\* Foo, The Foo package, <https://foo.example/>
--[ ]
\* Bar
--[ ]
\* Baz
-- TYPE1 pkgs found
\* Foo, The Foo package, <https://foo.example/>
-- TYPE2 pkgs not found
\* Bar
-- TYPE3 pkgs not found
\* Baz
-- The following first type packages have been found:
\* Foo, The Foo package, <https://foo.example/>
-- The following second type packages have not been found:
\* Bar
-- The following third type packages have not been found:
\* Baz
-- Configuring done

View File

@ -0,0 +1,158 @@
include(FeatureSummary)
set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
find_package(Foo)
find_package(Bar)
find_package(Baz)
set_package_properties(Foo PROPERTIES TYPE TYPE1)
set_package_properties(Bar PROPERTIES TYPE TYPE2)
set_package_properties(Baz PROPERTIES TYPE TYPE3)
feature_summary(WHAT ALL)
feature_summary(WHAT TYPE1_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE1_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE2_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE2_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE3_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE3_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE1_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE1 pkgs found\n")
feature_summary(WHAT TYPE1_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE1 pkgs not found\n")
feature_summary(WHAT TYPE2_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE2 pkgs found\n")
feature_summary(WHAT TYPE2_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE2 pkgs not found\n")
feature_summary(WHAT TYPE3_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE3 pkgs found\n")
feature_summary(WHAT TYPE3_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE3 pkgs not found\n")
feature_summary(WHAT TYPE1_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE1_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE2_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE2_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE3_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE3_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
set_property(GLOBAL PROPERTY FeatureSummary_TYPE1_DESCRIPTION "first type packages")
set_property(GLOBAL PROPERTY FeatureSummary_TYPE2_DESCRIPTION "second type packages")
set_property(GLOBAL PROPERTY FeatureSummary_TYPE3_DESCRIPTION "third type packages")
feature_summary(WHAT ALL)
feature_summary(WHAT TYPE1_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE1_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE2_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE2_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE3_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE3_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY)
feature_summary(WHAT TYPE1_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE1 pkgs found\n")
feature_summary(WHAT TYPE1_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE1 pkgs not found\n")
feature_summary(WHAT TYPE2_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE2 pkgs found\n")
feature_summary(WHAT TYPE2_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE2 pkgs not found\n")
feature_summary(WHAT TYPE3_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE3 pkgs found\n")
feature_summary(WHAT TYPE3_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DESCRIPTION "TYPE3 pkgs not found\n")
feature_summary(WHAT TYPE1_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE1_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE2_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE2_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE3_PACKAGES_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)
feature_summary(WHAT TYPE3_PACKAGES_NOT_FOUND
INCLUDE_QUIET_PACKAGES
QUIET_ON_EMPTY
DEFAULT_DESCRIPTION)

View File

@ -20,3 +20,4 @@ run_cmake(FeatureSummaryCustomBadDefault)
run_cmake(FeatureSummaryCustomRequired)
run_cmake(FeatureSummaryCustomRequiredListA)
run_cmake(FeatureSummaryCustomRequiredListB)
run_cmake(FeatureSummaryCustomDescription)