FeatureSummary.cmake 21 KB

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