FeatureSummary: Clean printed output

* Remove space before commas
* Do not add an empty line before the first type of packages

Also fix a typo in unit test.
This commit is contained in:
Daniele E. Domenichelli
2017-01-20 18:59:17 +01:00
parent a007f15344
commit 4da3cae9ff
6 changed files with 17 additions and 14 deletions

View File

@@ -14,12 +14,12 @@ packages and/or feature for a build tree such as::
LibXml2 (required version >= 2.4), XML processing lib, <http://xmlsoft.org> LibXml2 (required version >= 2.4), XML processing lib, <http://xmlsoft.org>
* Enables HTML-import in MyWordProcessor * Enables HTML-import in MyWordProcessor
* Enables odt-export in MyWordProcessor * Enables odt-export in MyWordProcessor
PNG , A PNG image library. , <http://www.libpng.org/pub/png/> PNG, A PNG image library., <http://www.libpng.org/pub/png/>
* Enables saving screenshots * Enables saving screenshots
-- The following OPTIONAL packages have not been found: -- The following OPTIONAL packages have not been found:
Lua51 , The Lua scripting language. , <http://www.lua.org> Lua51, The Lua scripting language., <http://www.lua.org>
* Enables macros in MyWordProcessor * Enables macros in MyWordProcessor
Foo , Foo provides cool stuff. Foo, Foo provides cool stuff.
Functions Functions
^^^^^^^^^ ^^^^^^^^^
@@ -87,11 +87,11 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
endif() endif()
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION) get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION)
if(_info) if(_info)
string(APPEND _currentFeatureText " , ${_info}") string(APPEND _currentFeatureText ", ${_info}")
endif() endif()
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL) get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL)
if(_info) if(_info)
string(APPEND _currentFeatureText " , <${_info}>") string(APPEND _currentFeatureText ", <${_info}>")
endif() endif()
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE) get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE)
@@ -287,7 +287,10 @@ function(FEATURE_SUMMARY)
set(_tmp) set(_tmp)
_FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES}) _FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES})
if(_tmp) if(_tmp)
string(APPEND _fullText "\n-- ${title_${part}}\n${_tmp}\n") if(_fullText)
string(APPEND _fullText "\n-- ")
endif()
string(APPEND _fullText "${title_${part}}\n${_tmp}\n")
if("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") if("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND")
set(requiredPackagesNotFound TRUE) set(requiredPackagesNotFound TRUE)
endif() endif()

View File

@@ -1,7 +1,7 @@
-- The following features have been enabled: -- The following features have been enabled:
\* Foo , Foo\. \* Foo, Foo\.
-- The following features have been disabled: -- The following features have been disabled:
\* Bar , Bar\. \* Bar, Bar\.

View File

@@ -1,7 +1,7 @@
-- The following features have been disabled: -- The following features have been disabled:
\* Bar , Bar\. \* Bar, Bar\.
-- The following features have been enabled: -- The following features have been enabled:
\* Foo , Foo\. \* Foo, Foo\.

View File

@@ -1,4 +1,4 @@
--( ) --( )
\* Foo , Foo decscription\. \* Foo, Foo description\.
+ +
-- --

View File

@@ -2,7 +2,7 @@ include(FeatureSummary)
set(WITH_FOO 1) set(WITH_FOO 1)
add_feature_info(Foo WITH_FOO "Foo decscription.") add_feature_info(Foo WITH_FOO "Foo description.")
add_feature_info(Foo WITH_FOO "Foo decscription.") add_feature_info(Foo WITH_FOO "Foo description.")
feature_summary(WHAT ENABLED_FEATURES) feature_summary(WHAT ENABLED_FEATURES)

View File

@@ -1 +1 @@
\* Foo , Foo\. \* Foo, Foo\.