FeatureSummary.cmake 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. # - Macros for generating a summary of enabled/disabled features
  2. #
  3. # This module provides the macros feature_summary(), set_package_properties() and
  4. # add_feature_info().
  5. # For compatibility it also still provides set_package_info(), set_feature_info(),
  6. # print_enabled_features() and print_disabled_features().
  7. #
  8. # These macros can be used to generate a summary of enabled and disabled
  9. # packages and/or feature for a build tree:
  10. #
  11. # -- The following OPTIONAL packages have been found:
  12. # LibXml2 (required version >= 2.4) , XML processing library. , <http://xmlsoft.org>
  13. # * Enables HTML-import in MyWordProcessor
  14. # * Enables odt-export in MyWordProcessor
  15. # PNG , A PNG image library. , <http://www.libpng.org/pub/png/>
  16. # * Enables saving screenshots
  17. # -- The following OPTIONAL packages have not been found:
  18. # Lua51 , The Lua scripting language. , <http://www.lua.org>
  19. # * Enables macros in MyWordProcessor
  20. # Foo , Foo provides cool stuff.
  21. #
  22. #
  23. # FEATURE_SUMMARY( [FILENAME <file>]
  24. # [APPEND]
  25. # [VAR <variable_name>]
  26. # [INCLUDE_QUIET_PACKAGES]
  27. # [FATAL_ON_MISSING_REQUIRED_PACKAGES]
  28. # [DESCRIPTION "Found packages:"]
  29. # WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND
  30. # | ENABLED_FEATURES | DISABLED_FEATURES]
  31. # )
  32. #
  33. # The FEATURE_SUMMARY() macro can be used to print information about enabled
  34. # or disabled packages or features of a project.
  35. # By default, only the names of the features/packages will be printed and their
  36. # required version when one was specified. Use SET_PACKAGE_PROPERTIES() to add more
  37. # useful information, like e.g. a download URL for the respective package or their
  38. # purpose in the project.
  39. #
  40. # The WHAT option is the only mandatory option. Here you specify what information
  41. # will be printed:
  42. # ALL: print everything
  43. # ENABLED_FEATURES: the list of all features which are enabled
  44. # DISABLED_FEATURES: the list of all features which are disabled
  45. # PACKAGES_FOUND: the list of all packages which have been found
  46. # PACKAGES_NOT_FOUND: the list of all packages which have not been found
  47. # OPTIONAL_PACKAGES_FOUND: only those packages which have been found which have the type OPTIONAL
  48. # OPTIONAL_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type OPTIONAL
  49. # RECOMMENDED_PACKAGES_FOUND: only those packages which have been found which have the type RECOMMENDED
  50. # RECOMMENDED_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RECOMMENDED
  51. # REQUIRED_PACKAGES_FOUND: only those packages which have been found which have the type REQUIRED
  52. # REQUIRED_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type REQUIRED
  53. # RUNTIME_PACKAGES_FOUND: only those packages which have been found which have the type RUNTIME
  54. # RUNTIME_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RUNTIME
  55. #
  56. # If a FILENAME is given, the information is printed into this file. If APPEND
  57. # is used, it is appended to this file, otherwise the file is overwritten if
  58. # it already existed.
  59. # If the VAR option is used, the information is "printed" into the specified
  60. # variable.
  61. # If FILENAME is not used, the information is printed to the terminal.
  62. # Using the DESCRIPTION option a description or headline can be set which will
  63. # be printed above the actual content.
  64. # If INCLUDE_QUIET_PACKAGES is given, packages which have been searched with find_package(... QUIET) will
  65. # also be listed. By default they are skipped.
  66. # If FATAL_ON_MISSING_REQUIRED_PACKAGES is given, CMake will abort if a package which is marked as REQUIRED
  67. # has not been found.
  68. #
  69. # Example 1, append everything to a file:
  70. # feature_summary(WHAT ALL
  71. # FILENAME ${CMAKE_BINARY_DIR}/all.log APPEND)
  72. #
  73. # Example 2, print the enabled features into the variable enabledFeaturesText, including QUIET packages:
  74. # feature_summary(WHAT ENABLED_FEATURES
  75. # INCLUDE_QUIET_PACKAGES
  76. # DESCRIPTION "Enabled Features:"
  77. # VAR enabledFeaturesText)
  78. # message(STATUS "${enabledFeaturesText}")
  79. #
  80. #
  81. # SET_PACKAGE_PROPERTIES(<name> PROPERTIES [ URL <url> ]
  82. # [ DESCRIPTION <description> ]
  83. # [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ]
  84. # [ PURPOSE <purpose> ]
  85. # )
  86. #
  87. # Use this macro to set up information about the named package, which can
  88. # then be displayed via FEATURE_SUMMARY().
  89. # This can be done either directly in the Find-module or in the project
  90. # which uses the module after the FIND_PACKAGE() call.
  91. # The features for which information can be set are added automatically by the
  92. # find_package() command.
  93. #
  94. # URL: this should be the homepage of the package, or something similar. Ideally this is set
  95. # already directly in the Find-module.
  96. #
  97. # DESCRIPTION: A short description what that package is, at most one sentence.
  98. # Ideally this is set already directly in the Find-module.
  99. #
  100. # TYPE: What type of dependency has the using project on that package. Default is OPTIONAL.
  101. # In this case it is a package which can be used by the project when available at buildtime,
  102. # but it also work without. RECOMMENDED is similar to OPTIONAL, i.e. the project will build
  103. # if the package is not present, but the functionality of the resulting binaries will be severly
  104. # limited. If a REQUIRED package is not available at buildtime, the project may not even build. This
  105. # can be combined with the FATAL_ON_MISSING_REQUIRED_PACKAGES argument for feature_summary().
  106. # Last, a RUNTIME package is a package which is actually not used at all during the build, but
  107. # which is required for actually running the resulting binaries. So if such a package is missing,
  108. # the project can still be built, but it may not work later on. If set_package_properties() is called
  109. # multiple times for the same package with different TYPEs, the TYPE is only changed to higher
  110. # TYPEs ( RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED ), lower TYPEs are ignored.
  111. # The TYPE property is project-specific, so it cannot be set by the Find-module, but must be set in the project.
  112. #
  113. # PURPOSE: This describes which features this package enables in the project, i.e. it tells the user
  114. # what functionality he gets in the resulting binaries.
  115. # If set_package_properties() is called multiple times for a package, all PURPOSE properties are appended
  116. # to a list of purposes of the package in the project.
  117. # As the TYPE property, also the PURPOSE property
  118. # is project-specific, so it cannot be set by the Find-module, but must be set in the project.
  119. #
  120. #
  121. # Example for setting the info for a package:
  122. # find_package(LibXml2)
  123. # set_package_properties(LibXml2 PROPERTIES DESCRIPTION "A XML processing library."
  124. # URL "http://xmlsoft.org/")
  125. #
  126. # set_package_properties(LibXml2 PROPERTIES TYPE RECOMMENDED
  127. # PURPOSE "Enables HTML-import in MyWordProcessor")
  128. # ...
  129. # set_package_properties(LibXml2 PROPERTIES TYPE OPTIONAL
  130. # PURPOSE "Enables odt-export in MyWordProcessor")
  131. #
  132. # find_package(DBUS)
  133. # set_package_properties(DBUS PROPERTIES TYPE RUNTIME
  134. # PURPOSE "Necessary to disable the screensaver during a presentation" )
  135. #
  136. # ADD_FEATURE_INFO(<name> <enabled> <description>)
  137. # Use this macro to add information about a feature with the given <name>.
  138. # <enabled> contains whether this feature is enabled or not, <description>
  139. # is a text describing the feature.
  140. # The information can be displayed using feature_summary() for ENABLED_FEATURES
  141. # and DISABLED_FEATURES respectively.
  142. #
  143. # Example for setting the info for a feature:
  144. # option(WITH_FOO "Help for foo" ON)
  145. # add_feature_info(Foo WITH_FOO "The Foo feature provides very cool stuff.")
  146. #
  147. #
  148. # The following macros are provided for compatibility with previous CMake versions:
  149. #
  150. # SET_PACKAGE_INFO(<name> <description> [<url> [<purpose>] ] )
  151. # Use this macro to set up information about the named package, which can
  152. # then be displayed via FEATURE_SUMMARY().
  153. # This can be done either directly in the Find-module or in the project
  154. # which uses the module after the FIND_PACKAGE() call.
  155. # The features for which information can be set are added automatically by the
  156. # find_package() command.
  157. #
  158. # PRINT_ENABLED_FEATURES()
  159. # Does the same as FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
  160. #
  161. # PRINT_DISABLED_FEATURES()
  162. # Does the same as FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
  163. #
  164. # SET_FEATURE_INFO(<name> <description> [<url>] )
  165. # Does the same as SET_PACKAGE_INFO(<name> <description> <url> )
  166. #=============================================================================
  167. # Copyright 2007-2009 Kitware, Inc.
  168. #
  169. # Distributed under the OSI-approved BSD License (the "License");
  170. # see accompanying file Copyright.txt for details.
  171. #
  172. # This software is distributed WITHOUT ANY WARRANTY; without even the
  173. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  174. # See the License for more information.
  175. #=============================================================================
  176. # (To distribute this file outside of CMake, substitute the full
  177. # License text for the above reference.)
  178. INCLUDE(CMakeParseArguments)
  179. FUNCTION(ADD_FEATURE_INFO _name _enabled _desc)
  180. IF (${_enabled})
  181. SET_PROPERTY(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}")
  182. ELSE ()
  183. SET_PROPERTY(GLOBAL APPEND PROPERTY DISABLED_FEATURES "${_name}")
  184. ENDIF ()
  185. SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
  186. ENDFUNCTION(ADD_FEATURE_INFO)
  187. FUNCTION(SET_PACKAGE_PROPERTIES _name _props)
  188. IF(NOT "${_props}" STREQUAL "PROPERTIES")
  189. MESSAGE(FATAL_ERROR "PROPERTIES keyword is missing in SET_PACKAGE_PROPERTIES() call.")
  190. ENDIF()
  191. SET(options ) # none
  192. SET(oneValueArgs DESCRIPTION URL TYPE PURPOSE )
  193. SET(multiValueArgs ) # none
  194. CMAKE_PARSE_ARGUMENTS(_SPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
  195. IF(_SPP_UNPARSED_ARGUMENTS)
  196. MESSAGE(FATAL_ERROR "Unknown keywords given to SET_PACKAGE_PROPERTIES(): \"${_SPP_UNPARSED_ARGUMENTS}\"")
  197. ENDIF()
  198. IF(_SPP_DESCRIPTION)
  199. GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION)
  200. IF(_info AND NOT "${_info}" STREQUAL "${_SPP_DESCRIPTION}")
  201. MESSAGE(STATUS "Warning: Property DESCRIPTION for package ${_name} already set to \"${_info}\", overriding it with \"${_SPP_DESCRIPTION}\"")
  202. ENDIF()
  203. SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_SPP_DESCRIPTION}" )
  204. ENDIF()
  205. IF(_SPP_URL)
  206. GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_name}_URL)
  207. IF(_info AND NOT "${_info}" STREQUAL "${_SPP_URL}")
  208. MESSAGE(STATUS "Warning: Property URL already set to \"${_info}\", overriding it with \"${_SPP_URL}\"")
  209. ENDIF()
  210. SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_SPP_URL}" )
  211. ENDIF()
  212. # handle the PURPOSE: use APPEND, since there can be multiple purposes for one package inside a project
  213. IF(_SPP_PURPOSE)
  214. SET_PROPERTY(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_SPP_PURPOSE}" )
  215. ENDIF()
  216. # handle the TYPE
  217. IF(NOT _SPP_TYPE)
  218. SET(_SPP_TYPE OPTIONAL)
  219. ENDIF()
  220. # List the supported types, according to their priority
  221. SET(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" )
  222. LIST(FIND validTypes ${_SPP_TYPE} _typeIndexInList)
  223. IF("${_typeIndexInList}" STREQUAL "-1" )
  224. MESSAGE(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). "
  225. "Valid types are OPTIONAL, RECOMMENDED, REQUIRED and RUNTIME." )
  226. ENDIF()
  227. GET_PROPERTY(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE)
  228. LIST(FIND validTypes "${_previousType}" _prevTypeIndexInList)
  229. # make sure a previously set TYPE is not overridden with a lower new TYPE:
  230. IF("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}")
  231. SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" )
  232. ENDIF()
  233. ENDFUNCTION(SET_PACKAGE_PROPERTIES)
  234. FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
  235. SET(_type "ANY")
  236. IF("${_property}" MATCHES "REQUIRED_")
  237. SET(_type "REQUIRED")
  238. ELSEIF("${_property}" MATCHES "RECOMMENDED_")
  239. SET(_type "RECOMMENDED")
  240. ELSEIF("${_property}" MATCHES "RUNTIME_")
  241. SET(_type "RUNTIME")
  242. ELSEIF("${_property}" MATCHES "OPTIONAL_")
  243. SET(_type "OPTIONAL")
  244. ENDIF()
  245. IF("${_property}" MATCHES "PACKAGES_FOUND")
  246. SET(_property "PACKAGES_FOUND")
  247. ELSEIF("${_property}" MATCHES "PACKAGES_NOT_FOUND")
  248. SET(_property "PACKAGES_NOT_FOUND")
  249. ENDIF()
  250. SET(_currentFeatureText "")
  251. GET_PROPERTY(_EnabledFeatures GLOBAL PROPERTY ${_property})
  252. FOREACH(_currentFeature ${_EnabledFeatures})
  253. # does this package belong to the type we currently want to list ?
  254. GET_PROPERTY(_currentType GLOBAL PROPERTY _CMAKE_${_currentFeature}_TYPE)
  255. IF(NOT _currentType)
  256. SET(_currentType OPTIONAL)
  257. ENDIF()
  258. IF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}")
  259. # check whether the current feature/package should be in the output depending on whether it was QUIET or not
  260. SET(includeThisOne TRUE)
  261. # skip QUIET packages, except if they are REQUIRED or INCLUDE_QUIET_PACKAGES has been set
  262. IF((NOT "${_currentType}" STREQUAL "REQUIRED") AND NOT _includeQuiet)
  263. GET_PROPERTY(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET)
  264. IF(_isQuiet)
  265. SET(includeThisOne FALSE)
  266. ENDIF()
  267. ENDIF()
  268. IF(includeThisOne)
  269. SET(_currentFeatureText "${_currentFeatureText}\n * ${_currentFeature}")
  270. GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_REQUIRED_VERSION)
  271. IF(_info)
  272. SET(_currentFeatureText "${_currentFeatureText} (required version ${_info})")
  273. ENDIF(_info)
  274. GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION)
  275. IF(_info)
  276. SET(_currentFeatureText "${_currentFeatureText} , ${_info}")
  277. ENDIF(_info)
  278. GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL)
  279. IF(_info)
  280. SET(_currentFeatureText "${_currentFeatureText} , <${_info}>")
  281. ENDIF(_info)
  282. GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE)
  283. FOREACH(_purpose ${_info})
  284. SET(_currentFeatureText "${_currentFeatureText}\n * ${_purpose}")
  285. ENDFOREACH()
  286. ENDIF(includeThisOne)
  287. ENDIF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}")
  288. ENDFOREACH(_currentFeature)
  289. SET(${_var} "${_currentFeatureText}" PARENT_SCOPE)
  290. ENDFUNCTION(_FS_GET_FEATURE_SUMMARY)
  291. FUNCTION(FEATURE_SUMMARY)
  292. # CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
  293. SET(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
  294. SET(oneValueArgs FILENAME VAR DESCRIPTION WHAT)
  295. SET(multiValueArgs ) # none
  296. CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
  297. IF(_FS_UNPARSED_ARGUMENTS)
  298. MESSAGE(FATAL_ERROR "Unknown keywords given to FEATURE_SUMMARY(): \"${_FS_UNPARSED_ARGUMENTS}\"")
  299. ENDIF()
  300. IF(NOT _FS_WHAT)
  301. MESSAGE(FATAL_ERROR "The call to FEATURE_SUMMARY() doesn't set the required WHAT argument.")
  302. ENDIF()
  303. SET(validWhatParts "ENABLED_FEATURES"
  304. "DISABLED_FEATURES"
  305. "PACKAGES_FOUND"
  306. "PACKAGES_NOT_FOUND"
  307. "OPTIONAL_PACKAGES_FOUND"
  308. "OPTIONAL_PACKAGES_NOT_FOUND"
  309. "RECOMMENDED_PACKAGES_FOUND"
  310. "RECOMMENDED_PACKAGES_NOT_FOUND"
  311. "REQUIRED_PACKAGES_FOUND"
  312. "REQUIRED_PACKAGES_NOT_FOUND"
  313. "RUNTIME_PACKAGES_FOUND"
  314. "RUNTIME_PACKAGES_NOT_FOUND")
  315. LIST(FIND validWhatParts "${_FS_WHAT}" indexInList)
  316. IF(NOT "${indexInList}" STREQUAL "-1")
  317. _FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} )
  318. SET(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
  319. IF (("${_FS_WHAT}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") AND _featureSummary)
  320. SET(requiredPackagesNotFound TRUE)
  321. ENDIF()
  322. ELSEIF("${_FS_WHAT}" STREQUAL "ALL")
  323. SET(allWhatParts "ENABLED_FEATURES"
  324. "RUNTIME_PACKAGES_FOUND"
  325. "OPTIONAL_PACKAGES_FOUND"
  326. "RECOMMENDED_PACKAGES_FOUND"
  327. "REQUIRED_PACKAGES_FOUND"
  328. "DISABLED_FEATURES"
  329. "RUNTIME_PACKAGES_NOT_FOUND"
  330. "OPTIONAL_PACKAGES_NOT_FOUND"
  331. "RECOMMENDED_PACKAGES_NOT_FOUND"
  332. "REQUIRED_PACKAGES_NOT_FOUND"
  333. )
  334. SET(title_ENABLED_FEATURES "The following features have been enabled:")
  335. SET(title_DISABLED_FEATURES "The following features have been disabled:")
  336. SET(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:")
  337. SET(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:")
  338. SET(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:")
  339. SET(title_RECOMMENDED_PACKAGES_NOT_FOUND "The following RECOMMENDED packages have not been found:")
  340. SET(title_REQUIRED_PACKAGES_FOUND "The following REQUIRED packages have been found:")
  341. SET(title_REQUIRED_PACKAGES_NOT_FOUND "The following REQUIRED packages have not been found:")
  342. SET(title_RUNTIME_PACKAGES_FOUND "The following RUNTIME packages have been found:")
  343. SET(title_RUNTIME_PACKAGES_NOT_FOUND "The following RUNTIME packages have not been found:")
  344. SET(_fullText "${_FS_DESCRIPTION}")
  345. FOREACH(part ${allWhatParts})
  346. SET(_tmp)
  347. _FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES})
  348. IF(_tmp)
  349. SET(_fullText "${_fullText}\n\n-- ${title_${part}}\n${_tmp}")
  350. IF("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND")
  351. SET(requiredPackagesNotFound TRUE)
  352. ENDIF()
  353. ENDIF()
  354. ENDFOREACH()
  355. ELSE()
  356. MESSAGE(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() is set to ${_FS_WHAT}, which is not a valid value.")
  357. ENDIF()
  358. IF(_FS_FILENAME)
  359. IF(_FS_APPEND)
  360. FILE(APPEND "${_FS_FILENAME}" "${_fullText}")
  361. ELSE(_FS_APPEND)
  362. FILE(WRITE "${_FS_FILENAME}" "${_fullText}")
  363. ENDIF()
  364. ELSE(_FS_FILENAME)
  365. IF(NOT _FS_VAR)
  366. MESSAGE(STATUS "${_fullText}")
  367. ENDIF()
  368. ENDIF()
  369. IF(_FS_VAR)
  370. SET(${_FS_VAR} "${_fullText}" PARENT_SCOPE)
  371. ENDIF()
  372. IF(requiredPackagesNotFound AND _FS_FATAL_ON_MISSING_REQUIRED_PACKAGES)
  373. MESSAGE(FATAL_ERROR "feature_summary() Error: REQUIRED package(s) are missing, aborting CMake run.")
  374. ENDIF()
  375. ENDFUNCTION(FEATURE_SUMMARY)
  376. # The stuff below is only kept for compatibility
  377. FUNCTION(SET_PACKAGE_INFO _name _desc)
  378. SET(_url "${ARGV2}")
  379. SET(_purpose "${ARGV3}")
  380. SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
  381. IF(_url MATCHES ".+")
  382. SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" )
  383. ENDIF()
  384. IF(_purpose MATCHES ".+")
  385. SET_PROPERTY(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_purpose}" )
  386. ENDIF()
  387. ENDFUNCTION(SET_PACKAGE_INFO)
  388. FUNCTION(SET_FEATURE_INFO)
  389. SET_PACKAGE_INFO(${ARGN})
  390. ENDFUNCTION(SET_FEATURE_INFO)
  391. FUNCTION(PRINT_ENABLED_FEATURES)
  392. FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
  393. ENDFUNCTION(PRINT_ENABLED_FEATURES)
  394. FUNCTION(PRINT_DISABLED_FEATURES)
  395. FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
  396. ENDFUNCTION(PRINT_DISABLED_FEATURES)