ENH: update for Tcl/Tk 8.5
[cmake.git] / Modules / FeatureSummary.cmake
blob788ad02a3b68ed3e4396a7d366022babee6c75ca
1 # - Macros for generating a summary of enabled/disabled features
3 # PRINT_ENABLED_FEATURES()
4 #   Print a summary of all enabled features. By default all successfull
5 #   FIND_PACKAGE() calls will appear here, except the ones which used the QUIET keyword.
6 #   Additional features can be added by appending an entry to the global ENABLED_FEATURES
7 #   property. If SET_FEATURE_INFO() is used for that feature, the output will be much 
8 #   more informative.
10 # PRINT_DISABLED_FEATURES()
11 #   Same as PRINT_ENABLED_FEATURES(), but for disabled features. It can be extended
12 #   the same way by adding to the global property DISABLED_FEATURES.
14 # SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ] )
15 #    Use this macro to set up information about the named feature, which will
16 #    then be displayed by PRINT_ENABLED/DISABLED_FEATURES().
17 #    Example: SET_FEATURE_INFO(LibXml2 "XML processing library." "http://xmlsoft.org/")
21 MACRO(SET_FEATURE_INFO _name _desc)
22   SET(_url "${ARGV2}")
23   SET(_comment "${ARGV3}")
24   SET_PROPERTY(GLOBAL PROPERTY ${_name}_DESCRIPTION "${_desc}" )
25   IF(_url MATCHES ".+")
26     SET_PROPERTY(GLOBAL PROPERTY ${_name}_URL "${_url}" )
27   ENDIF(_url MATCHES ".+")
28   IF(_comment MATCHES ".+")
29     SET_PROPERTY(GLOBAL PROPERTY ${_name}_COMMENT "${_comment}" )
30   ENDIF(_comment MATCHES ".+")
31 ENDMACRO(SET_FEATURE_INFO)
34 MACRO(_PRINT_FEATURES _property _text)
35   SET(_currentFeatureText "${_text}")
36   GET_PROPERTY(_EnabledFeatures  GLOBAL PROPERTY ${_property})
37   FOREACH(_currentFeature ${_EnabledFeatures})
38     SET(_currentFeatureText "${_currentFeatureText}\n${_currentFeature}")
39     GET_PROPERTY(_info  GLOBAL PROPERTY ${_currentFeature}_DESCRIPTION)
40     IF(_info)
41       SET(_currentFeatureText "${_currentFeatureText} , ${_info}")
42     ENDIF(_info)
43     GET_PROPERTY(_info  GLOBAL PROPERTY ${_currentFeature}_URL)
44     IF(_info)
45       SET(_currentFeatureText "${_currentFeatureText} , <${_info}>")
46     ENDIF(_info)
47     GET_PROPERTY(_info  GLOBAL PROPERTY ${_currentFeature}_COMMENT)
48     IF(_info)
49       SET(_currentFeatureText "${_currentFeatureText} , ${_info}")
50     ENDIF(_info)
51   ENDFOREACH(_currentFeature)
52   MESSAGE(STATUS "${_currentFeatureText}\n")
53 ENDMACRO(_PRINT_FEATURES)
56 MACRO(PRINT_ENABLED_FEATURES)
57    _PRINT_FEATURES( ENABLED_FEATURES "Enabled features:")
58 ENDMACRO(PRINT_ENABLED_FEATURES)
61 MACRO(PRINT_DISABLED_FEATURES)
62    _PRINT_FEATURES( DISABLED_FEATURES "Disabled features:")
63 ENDMACRO(PRINT_DISABLED_FEATURES)