diff options
author | Alex Neundorf <neundorf@kde.org> | 2012-03-18 16:26:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-03-19 14:53:36 (GMT) |
commit | 34108cd3b3bf992c0e77ae604125cb73e023f6a8 (patch) | |
tree | 6928561e885847f4107e2fb9466a1d1ca4c7524a /Modules/readme.txt | |
parent | cdabde82c27e4bbf6a4fb54a96b6f0af520ac761 (diff) | |
download | CMake-34108cd3b3bf992c0e77ae604125cb73e023f6a8.zip CMake-34108cd3b3bf992c0e77ae604125cb73e023f6a8.tar.gz CMake-34108cd3b3bf992c0e77ae604125cb73e023f6a8.tar.bz2 |
find_package: add documentation for OPTIONAL_COMPONENTS
This patch adds documentation for OPTIONAL_COMPONENTS to cmFindPackage.cxx,
and also extends Modules/readme.txt significantly with regard to how
components should be handled.
Alex
Diffstat (limited to 'Modules/readme.txt')
-rw-r--r-- | Modules/readme.txt | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/Modules/readme.txt b/Modules/readme.txt index e2d7f06..7d61d8d 100644 --- a/Modules/readme.txt +++ b/Modules/readme.txt @@ -57,7 +57,7 @@ For example: # - This is a cool module # This module does really cool stuff. # It can do even more than you think. -# +# # It even needs to paragraphs to tell you about it. # And it defines the following variables: # VAR_COOL - this is great isn't it? @@ -119,17 +119,31 @@ able to find the package. If the REQUIRED option is given to the command it will set the variable XXX_FIND_REQUIRED to true before loading the FindXXX.cmake module. If this variable is set the module should issue a FATAL_ERROR if the -package cannot be found. For each package-specific component, say -YYY, listed after the REQUIRED option a variable XXX_FIND_REQUIRED_YYY -to true. The set of components listed after either the REQUIRED -option or the COMPONENTS option will be specified in a -XXX_FIND_COMPONENTS variable. This can be used by the FindXXX.cmake -module to determine which sub-components of the package must be found. +package cannot be found. If neither the QUIET nor REQUIRED options are given then the FindXXX.cmake module should look for the package and complain without error if the module is not found. -To get this behaviour you can use the FIND_PACKAGE_HANDLE_STANDARD_ARGS() +A package can be provide sub-components. +Those components can be listed after the COMPONENTS (or REQUIRED) +or OPTIONAL_COMPONENTS keywords. The set of all listed components will be +specified in a XXX_FIND_COMPONENTS variable. +For each package-specific component, say Yyy, a variable XXX_FIND_REQUIRED_Yyy +will be set to true if it listed after COMPONENTS and it will be set to false +if it was listed after OPTIONAL_COMPONENTS. +Using those variables a FindXXX.cmake module and also a XXXConfig.cmake package +configuration file can determine whether and which components have been requested, +and whether they were requested as required or as optional. +For each of the requested components a XXX_Yyy_FOUND variable should be set +accordingly. +The per-package XXX_FOUND variable should be only set to true if all requested +required components have been found. A missing optional component should not +keep the XXX_FOUND variable from being set to true. +If the package provides XXX_INCLUDE_DIRS and XXX_LIBRARIES variables, the include +dirs and libraries for all components which were requested and which have been +found should be added to those two variables. + +To get this behaviour you can use the FIND_PACKAGE_HANDLE_STANDARD_ARGS() macro, as an example see FindJPEG.cmake. For internal implementation, it's a generally accepted convention that variables starting with |