FeatureSummary.cmake 21 KB

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