cmake-developer.7.rst 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. .. cmake-manual-description: CMake Developer Reference
  2. cmake-developer(7)
  3. ******************
  4. .. only:: html or latex
  5. .. contents::
  6. Introduction
  7. ============
  8. This manual is intended for reference by developers modifying the CMake
  9. source tree itself.
  10. Permitted C++ Subset
  11. ====================
  12. CMake is required to build with ancient C++ compilers and standard library
  13. implementations. Some common C++ constructs may not be used in CMake in order
  14. to build with such toolchains.
  15. std::vector::at
  16. ---------------
  17. The ``at()`` member function of ``std::vector`` may not be used. Use
  18. ``operator[]`` instead:
  19. .. code-block:: c++
  20. std::vector<int> someVec = getVec();
  21. int i1 = someVec.at(5); // Wrong
  22. int i2 = someVec[5]; // Ok
  23. std::string::append
  24. -------------------
  25. The ``append()`` member function of ``std::string`` may not be used. Use
  26. ``operator+=`` instead:
  27. .. code-block:: c++
  28. std::string stringBuilder;
  29. stringBuilder.append("chunk"); // Wrong
  30. stringBuilder += "chunk"; // Ok
  31. std::set const iterators
  32. ------------------------
  33. The ``find()`` member function of a ``const`` ``std::set`` instance may not be
  34. used in a comparison with the iterator returned by ``end()``:
  35. .. code-block:: c++
  36. const std::set<cmStdString>& someSet = getSet();
  37. if (someSet.find("needle") == someSet.end()) // Wrong
  38. {
  39. // ...
  40. }
  41. The return value of ``find()`` must be assigned to an intermediate
  42. ``const_iterator`` for comparison:
  43. .. code-block:: c++
  44. const std::set<cmStdString>& someSet;
  45. const std::set<cmStdString>::const_iterator i = someSet.find("needle");
  46. if (i != propSet.end()) // Ok
  47. {
  48. // ...
  49. }
  50. Char Array to ``string`` Conversions with Algorithms
  51. ----------------------------------------------------
  52. In some implementations, algorithms operating on iterators to a container of
  53. ``std::string`` can not accept a ``const char*`` value:
  54. .. code-block:: c++
  55. const char* dir = /*...*/;
  56. std::vector<std::string> vec;
  57. // ...
  58. std::binary_find(vec.begin(), vec.end(), dir); // Wrong
  59. The ``std::string`` may need to be explicitly constructed:
  60. .. code-block:: c++
  61. const char* dir = /*...*/;
  62. std::vector<std::string> vec;
  63. // ...
  64. std::binary_find(vec.begin(), vec.end(), std::string(dir)); // Ok
  65. std::auto_ptr
  66. -------------
  67. Some implementations have a ``std::auto_ptr`` which can not be used as a
  68. return value from a function. ``std::auto_ptr`` may not be used. Use
  69. ``cmsys::auto_ptr`` instead.
  70. std::vector::insert and std::set
  71. --------------------------------
  72. Use of ``std::vector::insert`` with an iterator whose ``element_type`` requires
  73. conversion is not allowed:
  74. .. code-block:: c++
  75. std::set<cmStdString> theSet;
  76. std::vector<std::string> theVector;
  77. theVector.insert(theVector.end(), theSet.begin(), theSet.end()); // Wrong
  78. A loop must be used instead:
  79. .. code-block:: c++
  80. std::set<cmStdString> theSet;
  81. std::vector<std::string> theVector;
  82. for(std::set<cmStdString>::iterator li = theSet.begin();
  83. li != theSet.end(); ++li)
  84. {
  85. theVector.push_back(*li);
  86. }
  87. Template Parameter Defaults
  88. ---------------------------
  89. On ancient compilers, C++ template must use template parameters in function
  90. arguments. If no parameter of that type is needed, the common workaround is
  91. to add a defaulted pointer to the type to the templated function. However,
  92. this does not work with other ancient compilers:
  93. .. code-block:: c++
  94. template<typename PropertyType>
  95. PropertyType getTypedProperty(cmTarget* tgt, const char* prop,
  96. PropertyType* = 0) // Wrong
  97. {
  98. }
  99. .. code-block:: c++
  100. template<typename PropertyType>
  101. PropertyType getTypedProperty(cmTarget* tgt, const char* prop,
  102. PropertyType*) // Ok
  103. {
  104. }
  105. and invoke it with the value ``0`` explicitly in all cases.
  106. std::min and std::max
  107. ---------------------
  108. ``min`` and ``max`` are defined as macros on some systems. ``std::min`` and
  109. ``std::max`` may not be used. Use ``cmMinimum`` and ``cmMaximum`` instead.
  110. size_t
  111. ------
  112. Various implementations have differing implementation of ``size_t``. When
  113. assigning the result of ``.size()`` on a container for example, the result
  114. should not be assigned to an ``unsigned int`` or similar. ``std::size_t`` must
  115. not be used.
  116. Templates
  117. ---------
  118. Some template code is permitted, but with some limitations. Member templates
  119. may not be used, and template friends may not be used.
  120. Help
  121. ====
  122. The ``Help`` directory contains CMake help manual source files.
  123. They are written using the `reStructuredText`_ markup syntax and
  124. processed by `Sphinx`_ to generate the CMake help manuals.
  125. .. _`reStructuredText`: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
  126. .. _`Sphinx`: http://sphinx-doc.org
  127. Markup Constructs
  128. -----------------
  129. In addition to using Sphinx to generate the CMake help manuals, we
  130. also use a C++-implemented document processor to print documents for
  131. the ``--help-*`` command-line help options. It supports a subset of
  132. reStructuredText markup. When authoring or modifying documents,
  133. please verify that the command-line help looks good in addition to the
  134. Sphinx-generated html and man pages.
  135. The command-line help processor supports the following constructs
  136. defined by reStructuredText, Sphinx, and a CMake extension to Sphinx.
  137. ..
  138. Note: This list must be kept consistent with the cmRST implementation.
  139. CMake Domain directives
  140. Directives defined in the `CMake Domain`_ for defining CMake
  141. documentation objects are printed in command-line help output as
  142. if the lines were normal paragraph text with interpretation.
  143. CMake Domain interpreted text roles
  144. Interpreted text roles defined in the `CMake Domain`_ for
  145. cross-referencing CMake documentation objects are replaced by their
  146. link text in command-line help output. Other roles are printed
  147. literally and not processed.
  148. ``code-block`` directive
  149. Add a literal code block without interpretation. The command-line
  150. help processor prints the block content without the leading directive
  151. line and with common indentation replaced by one space.
  152. ``include`` directive
  153. Include another document source file. The command-line help
  154. processor prints the included document inline with the referencing
  155. document.
  156. literal block after ``::``
  157. A paragraph ending in ``::`` followed by a blank line treats
  158. the following indented block as literal text without interpretation.
  159. The command-line help processor prints the ``::`` literally and
  160. prints the block content with common indentation replaced by one
  161. space. We prefer the ``::`` to appear at the end of a paragraph
  162. line instead of as its own line.
  163. ``note`` directive
  164. Call out a side note. The command-line help processor prints the
  165. block content as if the lines were normal paragraph text with
  166. interpretation.
  167. ``parsed-literal`` directive
  168. Add a literal block with markup interpretation. The command-line
  169. help processor prints the block content without the leading
  170. directive line and with common indentation replaced by one space.
  171. ``productionlist`` directive
  172. Render context-free grammar productions. The command-line help
  173. processor prints the block content as if the lines were normal
  174. paragraph text with interpretation.
  175. ``replace`` directive
  176. Define a ``|substitution|`` replacement.
  177. The command-line help processor requires a substitution replacement
  178. to be defined before it is referenced.
  179. ``|substitution|`` reference
  180. Reference a substitution replacement previously defined by
  181. the ``replace`` directive. The command-line help processor
  182. performs the substitution and replaces all newlines in the
  183. replacement text with spaces.
  184. ``toctree`` directive
  185. Include other document sources in the Table-of-Contents
  186. document tree. The command-line help processor prints
  187. the referenced documents inline as part of the referencing
  188. document.
  189. Inline markup constructs not listed above are printed literally in the
  190. command-line help output. We prefer to use inline markup constructs that
  191. look correct in source form, so avoid use of \\-escapes in favor of inline
  192. literals when possible.
  193. Explicit markup blocks not matching directives listed above are removed from
  194. command-line help output. Do not use them, except for plain ``..`` comments
  195. that are removed by Sphinx too.
  196. Note that nested indentation of blocks is not recognized by the
  197. command-line help processor. Therefore:
  198. * Explicit markup blocks are recognized only when not indented
  199. inside other blocks.
  200. * Literal blocks after paragraphs ending in ``::`` but not
  201. at the top indentation level may consume all indented lines
  202. following them.
  203. Try to avoid these cases in practice.
  204. CMake Domain
  205. ------------
  206. CMake adds a `Sphinx Domain`_ called ``cmake``, also called the
  207. "CMake Domain". It defines several "object" types for CMake
  208. documentation:
  209. ``command``
  210. A CMake language command.
  211. ``generator``
  212. A CMake native build system generator.
  213. See the :manual:`cmake(1)` command-line tool's ``-G`` option.
  214. ``manual``
  215. A CMake manual page, like this :manual:`cmake-developer(7)` manual.
  216. ``module``
  217. A CMake module.
  218. See the :manual:`cmake-modules(7)` manual
  219. and the :command:`include` command.
  220. ``policy``
  221. A CMake policy.
  222. See the :manual:`cmake-policies(7)` manual
  223. and the :command:`cmake_policy` command.
  224. ``prop_cache, prop_dir, prop_gbl, prop_sf, prop_test, prop_tgt``
  225. A CMake cache, directory, global, source file, test, or target
  226. property, respectively. See the :manual:`cmake-properties(7)` manual
  227. and the :command:`set_property` command.
  228. ``variable``
  229. A CMake language variable.
  230. See the :manual:`cmake-variables(7)` manual
  231. and the :command:`set` command.
  232. Documentation objects in the CMake Domain come from two sources.
  233. First, the CMake extension to Sphinx transforms every document named
  234. with the form ``Help/<type>/<file-name>.rst`` to a domain object with
  235. type ``<type>``. The object name is extracted from the document title,
  236. which is expected to be of the form::
  237. <object-name>
  238. -------------
  239. and to appear at or near the top of the ``.rst`` file before any other
  240. lines starting in a letter, digit, or ``<``. If no such title appears
  241. literally in the ``.rst`` file, the object name is the ``<file-name>``.
  242. If a title does appear, it is expected that ``<file-name>`` is equal
  243. to ``<object-name>`` with any ``<`` and ``>`` characters removed.
  244. Second, the CMake Domain provides directives to define objects inside
  245. other documents:
  246. .. code-block:: rst
  247. .. command:: <command-name>
  248. This indented block documents <command-name>.
  249. .. variable:: <variable-name>
  250. This indented block documents <variable-name>.
  251. Object types for which no directive is available must be defined using
  252. the first approach above.
  253. .. _`Sphinx Domain`: http://sphinx-doc.org/domains.html
  254. Cross-References
  255. ----------------
  256. Sphinx uses reStructuredText interpreted text roles to provide
  257. cross-reference syntax. The `CMake Domain`_ provides for each
  258. domain object type a role of the same name to cross-reference it.
  259. CMake Domain roles are inline markup of the forms::
  260. :type:`name`
  261. :type:`text <name>`
  262. where ``type`` is the domain object type and ``name`` is the
  263. domain object name. In the first form the link text will be
  264. ``name`` (or ``name()`` if the type is ``command``) and in
  265. the second form the link text will be the explicit ``text``.
  266. For example, the code:
  267. .. code-block:: rst
  268. * The :command:`list` command.
  269. * The :command:`list(APPEND)` sub-command.
  270. * The :command:`list() command <list>`.
  271. * The :command:`list(APPEND) sub-command <list>`.
  272. * The :variable:`CMAKE_VERSION` variable.
  273. * The :prop_tgt:`OUTPUT_NAME_<CONFIG>` target property.
  274. produces:
  275. * The :command:`list` command.
  276. * The :command:`list(APPEND)` sub-command.
  277. * The :command:`list() command <list>`.
  278. * The :command:`list(APPEND) sub-command <list>`.
  279. * The :variable:`CMAKE_VERSION` variable.
  280. * The :prop_tgt:`OUTPUT_NAME_<CONFIG>` target property.
  281. Note that CMake Domain roles differ from Sphinx and reStructuredText
  282. convention in that the form ``a<b>``, without a space preceding ``<``,
  283. is interpreted as a name instead of link text with an explicit target.
  284. This is necessary because we use ``<placeholders>`` frequently in
  285. object names like ``OUTPUT_NAME_<CONFIG>``. The form ``a <b>``,
  286. with a space preceding ``<``, is still interpreted as a link text
  287. with an explicit target.
  288. Modules
  289. =======
  290. The ``Modules`` directory contains CMake-language ``.cmake`` module files.
  291. Module Documentation
  292. --------------------
  293. To document CMake module ``Modules/<module-name>.cmake``, modify
  294. ``Help/manual/cmake-modules.7.rst`` to reference the module in the
  295. ``toctree`` directive, in sorted order, as::
  296. /module/<module-name>
  297. Then add the module document file ``Help/module/<module-name>.rst``
  298. containing just the line::
  299. .. cmake-module:: ../../Modules/<module-name>.cmake
  300. The ``cmake-module`` directive will scan the module file to extract
  301. reStructuredText markup from comment blocks that start in ``.rst:``.
  302. Add to the top of ``Modules/<module-name>.cmake`` a
  303. :ref:`Line Comment` block of the form:
  304. .. code-block:: cmake
  305. #.rst:
  306. # <module-name>
  307. # -------------
  308. #
  309. # <reStructuredText documentation of module>
  310. or a :ref:`Bracket Comment` of the form:
  311. .. code-block:: cmake
  312. #[[.rst:
  313. <module-name>
  314. -------------
  315. <reStructuredText documentation of module>
  316. #]]
  317. Any number of ``=`` may be used in the opening and closing brackets
  318. as long as they match. Content on the line containing the closing
  319. bracket is excluded if and only if the line starts in ``#``.
  320. Additional such ``.rst:`` comments may appear anywhere in the module file.
  321. All such comments must start with ``#`` in the first column.
  322. For example, a ``Modules/Findxxx.cmake`` module may contain:
  323. .. code-block:: cmake
  324. #.rst:
  325. # FindXxx
  326. # -------
  327. #
  328. # This is a cool module.
  329. # This module does really cool stuff.
  330. # It can do even more than you think.
  331. #
  332. # It even needs two paragraphs to tell you about it.
  333. # And it defines the following variables:
  334. #
  335. # * VAR_COOL: this is great isn't it?
  336. # * VAR_REALLY_COOL: cool right?
  337. <code>
  338. #[========================================[.rst:
  339. .. command:: xxx_do_something
  340. This command does something for Xxx::
  341. xxx_do_something(some arguments)
  342. #]========================================]
  343. macro(xxx_do_something)
  344. <code>
  345. endmacro()
  346. Find Modules
  347. ------------
  348. A "find module" is a ``Modules/Find<package>.cmake`` file to be loaded
  349. by the :command:`find_package` command when invoked for ``<package>``.
  350. We would like all ``FindXxx.cmake`` files to produce consistent variable
  351. names. Please use the following consistent variable names for general use.
  352. Xxx_INCLUDE_DIRS
  353. The final set of include directories listed in one variable for use by client
  354. code. This should not be a cache entry.
  355. Xxx_LIBRARIES
  356. The libraries to link against to use Xxx. These should include full paths.
  357. This should not be a cache entry.
  358. Xxx_DEFINITIONS
  359. Definitions to use when compiling code that uses Xxx. This really shouldn't
  360. include options such as (-DHAS_JPEG)that a client source-code file uses to
  361. decide whether to #include <jpeg.h>
  362. Xxx_EXECUTABLE
  363. Where to find the Xxx tool.
  364. Xxx_Yyy_EXECUTABLE
  365. Where to find the Yyy tool that comes with Xxx.
  366. Xxx_LIBRARY_DIRS
  367. Optionally, the final set of library directories listed in one variable for
  368. use by client code. This should not be a cache entry.
  369. Xxx_ROOT_DIR
  370. Where to find the base directory of Xxx.
  371. Xxx_VERSION_Yy
  372. Expect Version Yy if true. Make sure at most one of these is ever true.
  373. Xxx_WRAP_Yy
  374. If False, do not try to use the relevant CMake wrapping command.
  375. Xxx_Yy_FOUND
  376. If False, optional Yy part of Xxx sytem is not available.
  377. Xxx_FOUND
  378. Set to false, or undefined, if we haven't found, or don't want to use Xxx.
  379. Xxx_NOT_FOUND_MESSAGE
  380. Should be set by config-files in the case that it has set Xxx_FOUND to FALSE.
  381. The contained message will be printed by the find_package() command and by
  382. find_package_handle_standard_args() to inform the user about the problem.
  383. Xxx_RUNTIME_LIBRARY_DIRS
  384. Optionally, the runtime library search path for use when running an
  385. executable linked to shared libraries. The list should be used by user code
  386. to create the PATH on windows or LD_LIBRARY_PATH on unix. This should not be
  387. a cache entry.
  388. Xxx_VERSION_STRING
  389. A human-readable string containing the version of the package found, if any.
  390. Xxx_VERSION_MAJOR
  391. The major version of the package found, if any.
  392. Xxx_VERSION_MINOR
  393. The minor version of the package found, if any.
  394. Xxx_VERSION_PATCH
  395. The patch version of the package found, if any.
  396. You do not have to provide all of the above variables. You should provide
  397. Xxx_FOUND under most circumstances. If Xxx is a library, then Xxx_LIBRARIES,
  398. should also be defined, and Xxx_INCLUDE_DIRS should usually be defined (I
  399. guess libm.a might be an exception)
  400. The following names should not usually be used in CMakeLists.txt files, but
  401. they may be usefully modified in users' CMake Caches to control stuff.
  402. Xxx_LIBRARY
  403. Name of Xxx Library. A User may set this and Xxx_INCLUDE_DIR to ignore to
  404. force non-use of Xxx.
  405. Xxx_Yy_LIBRARY
  406. Name of Yy library that is part of the Xxx system. It may or may not be
  407. required to use Xxx.
  408. Xxx_INCLUDE_DIR
  409. Where to find xxx.h, etc. (Xxx_INCLUDE_PATH was considered bad because a path
  410. includes an actual filename.)
  411. Xxx_Yy_INCLUDE_DIR
  412. Where to find xxx_yy.h, etc.
  413. For tidiness's sake, try to keep as many options as possible out of the cache,
  414. leaving at least one option which can be used to disable use of the module, or
  415. locate a not-found library (e.g. Xxx_ROOT_DIR). For the same reason, mark
  416. most cache options as advanced.
  417. If you need other commands to do special things then it should still begin
  418. with ``Xxx_``. This gives a sort of namespace effect and keeps things tidy for the
  419. user. You should put comments describing all the exported settings, plus
  420. descriptions of any the users can use to control stuff.
  421. You really should also provide backwards compatibility any old settings that
  422. were actually in use. Make sure you comment them as deprecated, so that
  423. no-one starts using them.
  424. To add a module to the CMake documentation, follow the steps in the
  425. `Module Documentation`_ section above. Test the documentation formatting
  426. by running ``cmake --help-module FindXxx``, and also by enabling the
  427. ``SPHINX_HTML`` and ``SPHINX_MAN`` options to build the documentation.
  428. Edit the comments until generated documentation looks satisfactory.
  429. To have a .cmake file in this directory NOT show up in the modules
  430. documentation, simply leave out the ``Help/module/<module-name>.rst`` file
  431. and the ``Help/manual/cmake-modules.7.rst`` toctree entry.
  432. After the documentation, leave a *BLANK* line, and then add a
  433. copyright and licence notice block like this one::
  434. #=============================================================================
  435. # Copyright 2009-2011 Your Name
  436. #
  437. # Distributed under the OSI-approved BSD License (the "License");
  438. # see accompanying file Copyright.txt for details.
  439. #
  440. # This software is distributed WITHOUT ANY WARRANTY; without even the
  441. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  442. # See the License for more information.
  443. #=============================================================================
  444. # (To distribute this file outside of CMake, substitute the full
  445. # License text for the above reference.)
  446. The layout of the notice block is strictly enforced by the ``ModuleNotices``
  447. test. Only the year range and name may be changed freely.
  448. A FindXxx.cmake module will typically be loaded by the command::
  449. FIND_PACKAGE(Xxx [major[.minor[.patch[.tweak]]]] [EXACT]
  450. [QUIET] [[REQUIRED|COMPONENTS] [components...]])
  451. If any version numbers are given to the command it will set the following
  452. variables before loading the module:
  453. Xxx_FIND_VERSION
  454. full requested version string
  455. Xxx_FIND_VERSION_MAJOR
  456. major version if requested, else 0
  457. Xxx_FIND_VERSION_MINOR
  458. minor version if requested, else 0
  459. Xxx_FIND_VERSION_PATCH
  460. patch version if requested, else 0
  461. Xxx_FIND_VERSION_TWEAK
  462. tweak version if requested, else 0
  463. Xxx_FIND_VERSION_COUNT
  464. number of version components, 0 to 4
  465. Xxx_FIND_VERSION_EXACT
  466. true if EXACT option was given
  467. If the find module supports versioning it should locate a version of
  468. the package that is compatible with the version requested. If a
  469. compatible version of the package cannot be found the module should
  470. not report success. The version of the package found should be stored
  471. in "Xxx_VERSION..." version variables documented by the module.
  472. If the QUIET option is given to the command it will set the variable
  473. Xxx_FIND_QUIETLY to true before loading the FindXxx.cmake module. If
  474. this variable is set the module should not complain about not being
  475. able to find the package. If the
  476. REQUIRED option is given to the command it will set the variable
  477. Xxx_FIND_REQUIRED to true before loading the FindXxx.cmake module. If
  478. this variable is set the module should issue a FATAL_ERROR if the
  479. package cannot be found.
  480. If neither the QUIET nor REQUIRED options are given then the
  481. FindXxx.cmake module should look for the package and complain without
  482. error if the module is not found.
  483. FIND_PACKAGE() will set the variable CMAKE_FIND_PACKAGE_NAME to
  484. contain the actual name of the package.
  485. A package can provide sub-components.
  486. Those components can be listed after the COMPONENTS (or REQUIRED) or
  487. OPTIONAL_COMPONENTS keywords. The set of all listed components will be
  488. specified in a Xxx_FIND_COMPONENTS variable.
  489. For each package-specific component, say Yyy, a variable Xxx_FIND_REQUIRED_Yyy
  490. will be set to true if it listed after COMPONENTS and it will be set to false
  491. if it was listed after OPTIONAL_COMPONENTS.
  492. Using those variables a FindXxx.cmake module and also a XxxConfig.cmake
  493. package configuration file can determine whether and which components have
  494. been requested, and whether they were requested as required or as optional.
  495. For each of the requested components a Xxx_Yyy_FOUND variable should be set
  496. accordingly.
  497. The per-package Xxx_FOUND variable should be only set to true if all requested
  498. required components have been found. A missing optional component should not
  499. keep the Xxx_FOUND variable from being set to true.
  500. If the package provides Xxx_INCLUDE_DIRS and Xxx_LIBRARIES variables, the
  501. include dirs and libraries for all components which were requested and which
  502. have been found should be added to those two variables.
  503. To get this behaviour you can use the FIND_PACKAGE_HANDLE_STANDARD_ARGS()
  504. macro, as an example see FindJPEG.cmake.
  505. For internal implementation, it's a generally accepted convention that
  506. variables starting with underscore are for temporary use only. (variable
  507. starting with an underscore are not intended as a reserved prefix).