find_package.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. find_package
  2. ------------
  3. .. only:: html
  4. .. contents::
  5. Find an external project, and load its settings.
  6. .. _`basic signature`:
  7. Basic Signature and Module Mode
  8. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  9. .. code-block:: cmake
  10. find_package(<PackageName> [version] [EXACT] [QUIET] [MODULE]
  11. [REQUIRED] [[COMPONENTS] [components...]]
  12. [OPTIONAL_COMPONENTS components...]
  13. [NO_POLICY_SCOPE])
  14. Finds and loads settings from an external project. ``<PackageName>_FOUND``
  15. will be set to indicate whether the package was found. When the
  16. package is found package-specific information is provided through
  17. variables and :ref:`Imported Targets` documented by the package itself. The
  18. ``QUIET`` option disables informational messages, including those indicating
  19. that the package cannot be found if it is not ``REQUIRED``. The ``REQUIRED``
  20. option stops processing with an error message if the package cannot be found.
  21. A package-specific list of required components may be listed after the
  22. ``COMPONENTS`` option (or after the ``REQUIRED`` option if present).
  23. Additional optional components may be listed after
  24. ``OPTIONAL_COMPONENTS``. Available components and their influence on
  25. whether a package is considered to be found are defined by the target
  26. package.
  27. .. _FIND_PACKAGE_VERSION_FORMAT:
  28. The ``[version]`` argument requests a version with which the package found
  29. should be compatible. There are two possible forms in which it may be
  30. specified:
  31. * A single version with the format ``major[.minor[.patch[.tweak]]]``.
  32. * A version range with the format ``versionMin...[<]versionMax`` where
  33. ``versionMin`` and ``versionMax`` have the same format as the single
  34. version. By default, both end points are included. By specifying ``<``,
  35. the upper end point will be excluded.
  36. The ``EXACT`` option requests that the version be matched exactly. This option
  37. is incompatible with the specification of a version range.
  38. If no ``[version]`` and/or component list is given to a recursive invocation
  39. inside a find-module, the corresponding arguments are forwarded
  40. automatically from the outer call (including the ``EXACT`` flag for
  41. ``[version]``). Version support is currently provided only on a
  42. package-by-package basis (see the `Version Selection`_ section below).
  43. When a version range is specified but the package is only designed to expect
  44. a single version, the package will ignore the upper end point of the range and
  45. only take the single version at the lower end of the range into account.
  46. See the :command:`cmake_policy` command documentation for discussion
  47. of the ``NO_POLICY_SCOPE`` option.
  48. The command has two modes by which it searches for packages: "Module"
  49. mode and "Config" mode. The above signature selects Module mode.
  50. If no module is found the command falls back to Config mode, described
  51. below. This fall back is disabled if the ``MODULE`` option is given.
  52. In Module mode, CMake searches for a file called ``Find<PackageName>.cmake``.
  53. The file is first searched in the :variable:`CMAKE_MODULE_PATH`,
  54. then among the :ref:`Find Modules` provided by the CMake installation.
  55. If the file is found, it is read and processed by CMake. It is responsible
  56. for finding the package, checking the version, and producing any needed
  57. messages. Some find-modules provide limited or no support for versioning;
  58. check the module documentation.
  59. If the ``MODULE`` option is not specified in the above signature,
  60. CMake first searches for the package using Module mode. Then, if the
  61. package is not found, it searches again using Config mode. A user
  62. may set the variable :variable:`CMAKE_FIND_PACKAGE_PREFER_CONFIG` to
  63. ``TRUE`` to direct CMake first search using Config mode before falling
  64. back to Module mode.
  65. Full Signature and Config Mode
  66. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  67. User code should generally look for packages using the above `basic
  68. signature`_. The remainder of this command documentation specifies the
  69. full command signature and details of the search process. Project
  70. maintainers wishing to provide a package to be found by this command
  71. are encouraged to read on.
  72. The complete Config mode command signature is
  73. .. code-block:: cmake
  74. find_package(<PackageName> [version] [EXACT] [QUIET]
  75. [REQUIRED] [[COMPONENTS] [components...]]
  76. [OPTIONAL_COMPONENTS components...]
  77. [CONFIG|NO_MODULE]
  78. [NO_POLICY_SCOPE]
  79. [NAMES name1 [name2 ...]]
  80. [CONFIGS config1 [config2 ...]]
  81. [HINTS path1 [path2 ... ]]
  82. [PATHS path1 [path2 ... ]]
  83. [PATH_SUFFIXES suffix1 [suffix2 ...]]
  84. [NO_DEFAULT_PATH]
  85. [NO_PACKAGE_ROOT_PATH]
  86. [NO_CMAKE_PATH]
  87. [NO_CMAKE_ENVIRONMENT_PATH]
  88. [NO_SYSTEM_ENVIRONMENT_PATH]
  89. [NO_CMAKE_PACKAGE_REGISTRY]
  90. [NO_CMAKE_BUILDS_PATH] # Deprecated; does nothing.
  91. [NO_CMAKE_SYSTEM_PATH]
  92. [NO_CMAKE_SYSTEM_PACKAGE_REGISTRY]
  93. [CMAKE_FIND_ROOT_PATH_BOTH |
  94. ONLY_CMAKE_FIND_ROOT_PATH |
  95. NO_CMAKE_FIND_ROOT_PATH])
  96. The ``CONFIG`` option, the synonymous ``NO_MODULE`` option, or the use
  97. of options not specified in the `basic signature`_ all enforce pure Config
  98. mode. In pure Config mode, the command skips Module mode search and
  99. proceeds at once with Config mode search.
  100. Config mode search attempts to locate a configuration file provided by the
  101. package to be found. A cache entry called ``<PackageName>_DIR`` is created to
  102. hold the directory containing the file. By default the command
  103. searches for a package with the name ``<PackageName>``. If the ``NAMES`` option
  104. is given the names following it are used instead of ``<PackageName>``.
  105. The command searches for a file called ``<PackageName>Config.cmake`` or
  106. ``<lower-case-package-name>-config.cmake`` for each name specified.
  107. A replacement set of possible configuration file names may be given
  108. using the ``CONFIGS`` option. The search procedure is specified below.
  109. Once found, the configuration file is read and processed by CMake.
  110. Since the file is provided by the package it already knows the
  111. location of package contents. The full path to the configuration file
  112. is stored in the cmake variable ``<PackageName>_CONFIG``.
  113. All configuration files which have been considered by CMake while
  114. searching for an installation of the package with an appropriate
  115. version are stored in the cmake variable ``<PackageName>_CONSIDERED_CONFIGS``,
  116. the associated versions in ``<PackageName>_CONSIDERED_VERSIONS``.
  117. If the package configuration file cannot be found CMake will generate
  118. an error describing the problem unless the ``QUIET`` argument is
  119. specified. If ``REQUIRED`` is specified and the package is not found a
  120. fatal error is generated and the configure step stops executing. If
  121. ``<PackageName>_DIR`` has been set to a directory not containing a
  122. configuration file CMake will ignore it and search from scratch.
  123. Package maintainers providing CMake package configuration files are
  124. encouraged to name and install them such that the `Search Procedure`_
  125. outlined below will find them without requiring use of additional options.
  126. Version Selection
  127. ^^^^^^^^^^^^^^^^^
  128. When the ``[version]`` argument is given, Config mode will only find a
  129. version of the package that claims compatibility with the requested
  130. version (see :ref:`format specification <FIND_PACKAGE_VERSION_FORMAT>`). If the
  131. ``EXACT`` option is given, only a version of the package claiming an exact match
  132. of the requested version may be found. CMake does not establish any
  133. convention for the meaning of version numbers. Package version
  134. numbers are checked by "version" files provided by the packages
  135. themselves. For a candidate package configuration file
  136. ``<config-file>.cmake`` the corresponding version file is located next
  137. to it and named either ``<config-file>-version.cmake`` or
  138. ``<config-file>Version.cmake``. If no such version file is available
  139. then the configuration file is assumed to not be compatible with any
  140. requested version. A basic version file containing generic version
  141. matching code can be created using the
  142. :module:`CMakePackageConfigHelpers` module. When a version file
  143. is found it is loaded to check the requested version number. The
  144. version file is loaded in a nested scope in which the following
  145. variables have been defined:
  146. ``PACKAGE_FIND_NAME``
  147. The ``<PackageName>``
  148. ``PACKAGE_FIND_VERSION``
  149. Full requested version string
  150. ``PACKAGE_FIND_VERSION_MAJOR``
  151. Major version if requested, else 0
  152. ``PACKAGE_FIND_VERSION_MINOR``
  153. Minor version if requested, else 0
  154. ``PACKAGE_FIND_VERSION_PATCH``
  155. Patch version if requested, else 0
  156. ``PACKAGE_FIND_VERSION_TWEAK``
  157. Tweak version if requested, else 0
  158. ``PACKAGE_FIND_VERSION_COUNT``
  159. Number of version components, 0 to 4
  160. When a version range is specified, the above version variables will hold
  161. values based on the lower end of the version range. This is to preserve
  162. compatibility with packages that have not been implemented to expect version
  163. ranges. In addition, the version range will be described by the following
  164. variables:
  165. ``PACKAGE_FIND_VERSION_RANGE``
  166. Full requested version range string
  167. ``PACKAGE_FIND_VERSION_RANGE_MIN``
  168. This specifies whether the lower end point of the version range should be
  169. included or excluded. Currently, the only supported value for this variable
  170. is ``INCLUDE``.
  171. ``PACKAGE_FIND_VERSION_RANGE_MAX``
  172. This specifies whether the upper end point of the version range should be
  173. included or excluded. The supported values for this variable are
  174. ``INCLUDE`` and ``EXCLUDE``.
  175. ``PACKAGE_FIND_VERSION_MIN``
  176. Full requested version string of the lower end point of the range
  177. ``PACKAGE_FIND_VERSION_MIN_MAJOR``
  178. Major version of the lower end point if requested, else 0
  179. ``PACKAGE_FIND_VERSION_MIN_MINOR``
  180. Minor version of the lower end point if requested, else 0
  181. ``PACKAGE_FIND_VERSION_MIN_PATCH``
  182. Patch version of the lower end point if requested, else 0
  183. ``PACKAGE_FIND_VERSION_MIN_TWEAK``
  184. Tweak version of the lower end point if requested, else 0
  185. ``PACKAGE_FIND_VERSION_MIN_COUNT``
  186. Number of version components of the lower end point, 0 to 4
  187. ``PACKAGE_FIND_VERSION_MAX``
  188. Full requested version string of the upper end point of the range
  189. ``PACKAGE_FIND_VERSION_MAX_MAJOR``
  190. Major version of the upper end point if requested, else 0
  191. ``PACKAGE_FIND_VERSION_MAX_MINOR``
  192. Minor version of the upper end point if requested, else 0
  193. ``PACKAGE_FIND_VERSION_MAX_PATCH``
  194. Patch version of the upper end point if requested, else 0
  195. ``PACKAGE_FIND_VERSION_MAX_TWEAK``
  196. Tweak version of the upper end point if requested, else 0
  197. ``PACKAGE_FIND_VERSION_MAX_COUNT``
  198. Number of version components of the upper end point, 0 to 4
  199. Regardless of whether a single version or a version range is specified, the
  200. variable ``PACKAGE_FIND_VERSION_COMPLETE`` will be defined and will hold
  201. the full requested version string as specified.
  202. The version file checks whether it satisfies the requested version and
  203. sets these variables:
  204. ``PACKAGE_VERSION``
  205. Full provided version string
  206. ``PACKAGE_VERSION_EXACT``
  207. True if version is exact match
  208. ``PACKAGE_VERSION_COMPATIBLE``
  209. True if version is compatible
  210. ``PACKAGE_VERSION_UNSUITABLE``
  211. True if unsuitable as any version
  212. These variables are checked by the ``find_package`` command to determine
  213. whether the configuration file provides an acceptable version. They
  214. are not available after the ``find_package`` call returns. If the version
  215. is acceptable the following variables are set:
  216. ``<PackageName>_VERSION``
  217. Full provided version string
  218. ``<PackageName>_VERSION_MAJOR``
  219. Major version if provided, else 0
  220. ``<PackageName>_VERSION_MINOR``
  221. Minor version if provided, else 0
  222. ``<PackageName>_VERSION_PATCH``
  223. Patch version if provided, else 0
  224. ``<PackageName>_VERSION_TWEAK``
  225. Tweak version if provided, else 0
  226. ``<PackageName>_VERSION_COUNT``
  227. Number of version components, 0 to 4
  228. and the corresponding package configuration file is loaded.
  229. When multiple package configuration files are available whose version files
  230. claim compatibility with the version requested it is unspecified which
  231. one is chosen: unless the variable :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER`
  232. is set no attempt is made to choose a highest or closest version number.
  233. To control the order in which ``find_package`` checks for compatibility use
  234. the two variables :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER` and
  235. :variable:`CMAKE_FIND_PACKAGE_SORT_DIRECTION`.
  236. For instance in order to select the highest version one can set
  237. .. code-block:: cmake
  238. SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
  239. SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
  240. before calling ``find_package``.
  241. Search Procedure
  242. ^^^^^^^^^^^^^^^^
  243. CMake constructs a set of possible installation prefixes for the
  244. package. Under each prefix several directories are searched for a
  245. configuration file. The tables below show the directories searched.
  246. Each entry is meant for installation trees following Windows (``W``), UNIX
  247. (``U``), or Apple (``A``) conventions::
  248. <prefix>/ (W)
  249. <prefix>/(cmake|CMake)/ (W)
  250. <prefix>/<name>*/ (W)
  251. <prefix>/<name>*/(cmake|CMake)/ (W)
  252. <prefix>/(lib/<arch>|lib*|share)/cmake/<name>*/ (U)
  253. <prefix>/(lib/<arch>|lib*|share)/<name>*/ (U)
  254. <prefix>/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ (U)
  255. <prefix>/<name>*/(lib/<arch>|lib*|share)/cmake/<name>*/ (W/U)
  256. <prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/ (W/U)
  257. <prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ (W/U)
  258. On systems supporting macOS :prop_tgt:`FRAMEWORK` and :prop_tgt:`BUNDLE`, the
  259. following directories are searched for Frameworks or Application Bundles
  260. containing a configuration file::
  261. <prefix>/<name>.framework/Resources/ (A)
  262. <prefix>/<name>.framework/Resources/CMake/ (A)
  263. <prefix>/<name>.framework/Versions/*/Resources/ (A)
  264. <prefix>/<name>.framework/Versions/*/Resources/CMake/ (A)
  265. <prefix>/<name>.app/Contents/Resources/ (A)
  266. <prefix>/<name>.app/Contents/Resources/CMake/ (A)
  267. In all cases the ``<name>`` is treated as case-insensitive and corresponds
  268. to any of the names specified (``<PackageName>`` or names given by ``NAMES``).
  269. Paths with ``lib/<arch>`` are enabled if the
  270. :variable:`CMAKE_LIBRARY_ARCHITECTURE` variable is set. ``lib*`` includes one
  271. or more of the values ``lib64``, ``lib32``, ``libx32`` or ``lib`` (searched in
  272. that order).
  273. * Paths with ``lib64`` are searched on 64 bit platforms if the
  274. :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` property is set to ``TRUE``.
  275. * Paths with ``lib32`` are searched on 32 bit platforms if the
  276. :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS` property is set to ``TRUE``.
  277. * Paths with ``libx32`` are searched on platforms using the x32 ABI
  278. if the :prop_gbl:`FIND_LIBRARY_USE_LIBX32_PATHS` property is set to ``TRUE``.
  279. * The ``lib`` path is always searched.
  280. If ``PATH_SUFFIXES`` is specified, the suffixes are appended to each
  281. (``W``) or (``U``) directory entry one-by-one.
  282. This set of directories is intended to work in cooperation with
  283. projects that provide configuration files in their installation trees.
  284. Directories above marked with (``W``) are intended for installations on
  285. Windows where the prefix may point at the top of an application's
  286. installation directory. Those marked with (``U``) are intended for
  287. installations on UNIX platforms where the prefix is shared by multiple
  288. packages. This is merely a convention, so all (``W``) and (``U``) directories
  289. are still searched on all platforms. Directories marked with (``A``) are
  290. intended for installations on Apple platforms. The
  291. :variable:`CMAKE_FIND_FRAMEWORK` and :variable:`CMAKE_FIND_APPBUNDLE`
  292. variables determine the order of preference.
  293. The set of installation prefixes is constructed using the following
  294. steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are
  295. enabled.
  296. 1. Search paths specified in the :variable:`<PackageName>_ROOT` CMake
  297. variable and the :envvar:`<PackageName>_ROOT` environment variable,
  298. where ``<PackageName>`` is the package to be found.
  299. The package root variables are maintained as a stack so if
  300. called from within a find module, root paths from the parent's find
  301. module will also be searched after paths for the current package.
  302. This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
  303. the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
  304. See policy :policy:`CMP0074`.
  305. 2. Search paths specified in cmake-specific cache variables. These
  306. are intended to be used on the command line with a ``-DVAR=value``.
  307. The values are interpreted as :ref:`semicolon-separated lists <CMake Language Lists>`.
  308. This can be skipped if ``NO_CMAKE_PATH`` is passed or by setting the
  309. :variable:`CMAKE_FIND_USE_CMAKE_PATH` to ``FALSE``:
  310. * :variable:`CMAKE_PREFIX_PATH`
  311. * :variable:`CMAKE_FRAMEWORK_PATH`
  312. * :variable:`CMAKE_APPBUNDLE_PATH`
  313. 3. Search paths specified in cmake-specific environment variables.
  314. These are intended to be set in the user's shell configuration,
  315. and therefore use the host's native path separator
  316. (``;`` on Windows and ``:`` on UNIX).
  317. This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed or by setting
  318. the :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` to ``FALSE``:
  319. * ``<PackageName>_DIR``
  320. * :envvar:`CMAKE_PREFIX_PATH`
  321. * ``CMAKE_FRAMEWORK_PATH``
  322. * ``CMAKE_APPBUNDLE_PATH``
  323. 4. Search paths specified by the ``HINTS`` option. These should be paths
  324. computed by system introspection, such as a hint provided by the
  325. location of another item already found. Hard-coded guesses should
  326. be specified with the ``PATHS`` option.
  327. 5. Search the standard system environment variables. This can be
  328. skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed or by setting the
  329. :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``. Path entries
  330. ending in ``/bin`` or ``/sbin`` are automatically converted to their
  331. parent directories:
  332. * ``PATH``
  333. 6. Search paths stored in the CMake :ref:`User Package Registry`.
  334. This can be skipped if ``NO_CMAKE_PACKAGE_REGISTRY`` is passed or by
  335. setting the variable :variable:`CMAKE_FIND_USE_PACKAGE_REGISTRY`
  336. to ``FALSE`` or the deprecated variable
  337. :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY` to ``TRUE``.
  338. See the :manual:`cmake-packages(7)` manual for details on the user
  339. package registry.
  340. 7. Search cmake variables defined in the Platform files for the
  341. current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is
  342. passed or by setting the :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`
  343. to ``FALSE``:
  344. * :variable:`CMAKE_SYSTEM_PREFIX_PATH`
  345. * :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH`
  346. * :variable:`CMAKE_SYSTEM_APPBUNDLE_PATH`
  347. The platform paths that these variables contain are locations that
  348. typically include installed software. An example being ``/usr/local`` for
  349. UNIX based platforms.
  350. 8. Search paths stored in the CMake :ref:`System Package Registry`.
  351. This can be skipped if ``NO_CMAKE_SYSTEM_PACKAGE_REGISTRY`` is passed
  352. or by setting the :variable:`CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY`
  353. variable to ``FALSE`` or the deprecated variable
  354. :variable:`CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY` to ``TRUE``.
  355. See the :manual:`cmake-packages(7)` manual for details on the system
  356. package registry.
  357. 9. Search paths specified by the ``PATHS`` option. These are typically
  358. hard-coded guesses.
  359. .. |FIND_XXX| replace:: find_package
  360. .. |FIND_ARGS_XXX| replace:: <PackageName>
  361. .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace::
  362. :variable:`CMAKE_FIND_ROOT_PATH_MODE_PACKAGE`
  363. .. include:: FIND_XXX_ROOT.txt
  364. .. include:: FIND_XXX_ORDER.txt
  365. By default the value stored in the result variable will be the path at
  366. which the file is found. The :variable:`CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS`
  367. variable may be set to ``TRUE`` before calling ``find_package`` in order
  368. to resolve symbolic links and store the real path to the file.
  369. Every non-REQUIRED ``find_package`` call can be disabled by setting the
  370. :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable to ``TRUE``.
  371. Package File Interface Variables
  372. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  373. When loading a find module or package configuration file ``find_package``
  374. defines variables to provide information about the call arguments (and
  375. restores their original state before returning):
  376. ``CMAKE_FIND_PACKAGE_NAME``
  377. The ``<PackageName>`` which is searched for
  378. ``<PackageName>_FIND_REQUIRED``
  379. True if ``REQUIRED`` option was given
  380. ``<PackageName>_FIND_QUIETLY``
  381. True if ``QUIET`` option was given
  382. ``<PackageName>_FIND_VERSION``
  383. Full requested version string
  384. ``<PackageName>_FIND_VERSION_MAJOR``
  385. Major version if requested, else 0
  386. ``<PackageName>_FIND_VERSION_MINOR``
  387. Minor version if requested, else 0
  388. ``<PackageName>_FIND_VERSION_PATCH``
  389. Patch version if requested, else 0
  390. ``<PackageName>_FIND_VERSION_TWEAK``
  391. Tweak version if requested, else 0
  392. ``<PackageName>_FIND_VERSION_COUNT``
  393. Number of version components, 0 to 4
  394. ``<PackageName>_FIND_VERSION_EXACT``
  395. True if ``EXACT`` option was given
  396. ``<PackageName>_FIND_COMPONENTS``
  397. List of requested components
  398. ``<PackageName>_FIND_REQUIRED_<c>``
  399. True if component ``<c>`` is required,
  400. false if component ``<c>`` is optional
  401. When a version range is specified, the above version variables will hold
  402. values based on the lower end of the version range. This is to preserve
  403. compatibility with packages that have not been implemented to expect version
  404. ranges. In addition, the version range will be described by the following
  405. variables:
  406. ``<PackageName>_FIND_VERSION_RANGE``
  407. Full requested version range string
  408. ``<PackageName>_FIND_VERSION_RANGE_MIN``
  409. This specifies whether the lower end point of the version range is
  410. included or excluded. Currently, ``INCLUDE`` is the only supported value.
  411. ``<PackageName>_FIND_VERSION_RANGE_MAX``
  412. This specifies whether the upper end point of the version range is
  413. included or excluded. The possible values for this variable are
  414. ``INCLUDE`` or ``EXCLUDE``.
  415. ``<PackageName>_FIND_VERSION_MIN``
  416. Full requested version string of the lower end point of the range
  417. ``<PackageName>_FIND_VERSION_MIN_MAJOR``
  418. Major version of the lower end point if requested, else 0
  419. ``<PackageName>_FIND_VERSION_MIN_MINOR``
  420. Minor version of the lower end point if requested, else 0
  421. ``<PackageName>_FIND_VERSION_MIN_PATCH``
  422. Patch version of the lower end point if requested, else 0
  423. ``<PackageName>_FIND_VERSION_MIN_TWEAK``
  424. Tweak version of the lower end point if requested, else 0
  425. ``<PackageName>_FIND_VERSION_MIN_COUNT``
  426. Number of version components of the lower end point, 0 to 4
  427. ``<PackageName>_FIND_VERSION_MAX``
  428. Full requested version string of the upper end point of the range
  429. ``<PackageName>_FIND_VERSION_MAX_MAJOR``
  430. Major version of the upper end point if requested, else 0
  431. ``<PackageName>_FIND_VERSION_MAX_MINOR``
  432. Minor version of the upper end point if requested, else 0
  433. ``<PackageName>_FIND_VERSION_MAX_PATCH``
  434. Patch version of the upper end point if requested, else 0
  435. ``<PackageName>_FIND_VERSION_MAX_TWEAK``
  436. Tweak version of the upper end point if requested, else 0
  437. ``<PackageName>_FIND_VERSION_MAX_COUNT``
  438. Number of version components of the upper end point, 0 to 4
  439. Regardless of whether a single version or a version range is specified, the
  440. variable ``<PackageName>_FIND_VERSION_COMPLETE`` will be defined and will hold
  441. the full requested version string as specified.
  442. In Module mode the loaded find module is responsible to honor the
  443. request detailed by these variables; see the find module for details.
  444. In Config mode ``find_package`` handles ``REQUIRED``, ``QUIET``, and
  445. ``[version]`` options automatically but leaves it to the package
  446. configuration file to handle components in a way that makes sense
  447. for the package. The package configuration file may set
  448. ``<PackageName>_FOUND`` to false to tell ``find_package`` that component
  449. requirements are not satisfied.