FIND_XXX.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. A short-hand signature is:
  2. .. parsed-literal::
  3. |FIND_XXX| (<VAR> name1 [path1 path2 ...])
  4. The general signature is:
  5. .. parsed-literal::
  6. |FIND_XXX| (
  7. <VAR>
  8. name | |NAMES|
  9. [HINTS path1 [path2 ... ENV var]]
  10. [PATHS path1 [path2 ... ENV var]]
  11. [PATH_SUFFIXES suffix1 [suffix2 ...]]
  12. [DOC "cache documentation string"]
  13. [NO_DEFAULT_PATH]
  14. [NO_PACKAGE_ROOT_PATH]
  15. [NO_CMAKE_PATH]
  16. [NO_CMAKE_ENVIRONMENT_PATH]
  17. [NO_SYSTEM_ENVIRONMENT_PATH]
  18. [NO_CMAKE_SYSTEM_PATH]
  19. [CMAKE_FIND_ROOT_PATH_BOTH |
  20. ONLY_CMAKE_FIND_ROOT_PATH |
  21. NO_CMAKE_FIND_ROOT_PATH]
  22. )
  23. This command is used to find a |SEARCH_XXX_DESC|.
  24. A cache entry named by ``<VAR>`` is created to store the result
  25. of this command.
  26. If the |SEARCH_XXX| is found the result is stored in the variable
  27. and the search will not be repeated unless the variable is cleared.
  28. If nothing is found, the result will be
  29. ``<VAR>-NOTFOUND``, and the search will be attempted again the
  30. next time |FIND_XXX| is invoked with the same variable.
  31. Options include:
  32. ``NAMES``
  33. Specify one or more possible names for the |SEARCH_XXX|.
  34. When using this to specify names with and without a version
  35. suffix, we recommend specifying the unversioned name first
  36. so that locally-built packages can be found before those
  37. provided by distributions.
  38. ``HINTS``, ``PATHS``
  39. Specify directories to search in addition to the default locations.
  40. The ``ENV var`` sub-option reads paths from a system environment
  41. variable.
  42. ``PATH_SUFFIXES``
  43. Specify additional subdirectories to check below each directory
  44. location otherwise considered.
  45. ``DOC``
  46. Specify the documentation string for the ``<VAR>`` cache entry.
  47. If ``NO_DEFAULT_PATH`` is specified, then no additional paths are
  48. added to the search.
  49. If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
  50. .. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| replace::
  51. |prefix_XXX_SUBDIR| for each ``<prefix>`` in ``PackageName_ROOT`` if called
  52. from within a find module
  53. .. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace::
  54. |prefix_XXX_SUBDIR| for each ``<prefix>`` in :variable:`CMAKE_PREFIX_PATH`
  55. .. |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR| replace::
  56. |prefix_XXX_SUBDIR| for each ``<prefix>/[s]bin`` in ``PATH``, and
  57. |entry_XXX_SUBDIR| for other entries in ``PATH``
  58. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| replace::
  59. |prefix_XXX_SUBDIR| for each ``<prefix>`` in
  60. :variable:`CMAKE_SYSTEM_PREFIX_PATH`
  61. 1. If called from within a find module, search prefix paths unique to the
  62. current package being found. Specifically look in the ``PackageName_ROOT``
  63. CMake and environment variables. The package root variables are maintained
  64. as a stack so if called from nested find modules, root paths from the
  65. parent's find module will be searchd after paths from the current module,
  66. i.e. ``CurrentPackage_ROOT``, ``ENV{CurrentPackage_ROOT}``,
  67. ``ParentPackage_ROOT``, ``ENV{ParentPacakge_ROOT}``, etc.
  68. This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed.
  69. * |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX|
  70. 2. Search paths specified in cmake-specific cache variables.
  71. These are intended to be used on the command line with a ``-DVAR=value``.
  72. The values are interpreted as :ref:`;-lists <CMake Language Lists>`.
  73. This can be skipped if ``NO_CMAKE_PATH`` is passed.
  74. * |CMAKE_PREFIX_PATH_XXX|
  75. * |CMAKE_XXX_PATH|
  76. * |CMAKE_XXX_MAC_PATH|
  77. 3. Search paths specified in cmake-specific environment variables.
  78. These are intended to be set in the user's shell configuration,
  79. and therefore use the host's native path separator
  80. (``;`` on Windows and ``:`` on UNIX).
  81. This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed.
  82. * |CMAKE_PREFIX_PATH_XXX|
  83. * |CMAKE_XXX_PATH|
  84. * |CMAKE_XXX_MAC_PATH|
  85. 4. Search the paths specified by the ``HINTS`` option.
  86. These should be paths computed by system introspection, such as a
  87. hint provided by the location of another item already found.
  88. Hard-coded guesses should be specified with the ``PATHS`` option.
  89. 5. Search the standard system environment variables.
  90. This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument.
  91. * |SYSTEM_ENVIRONMENT_PATH_XXX|
  92. 6. Search cmake variables defined in the Platform files
  93. for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH``
  94. is passed.
  95. * |CMAKE_SYSTEM_PREFIX_PATH_XXX|
  96. * |CMAKE_SYSTEM_XXX_PATH|
  97. * |CMAKE_SYSTEM_XXX_MAC_PATH|
  98. 7. Search the paths specified by the PATHS option
  99. or in the short-hand version of the command.
  100. These are typically hard-coded guesses.
  101. .. |FIND_ARGS_XXX| replace:: <VAR> NAMES name
  102. On OS X the :variable:`CMAKE_FIND_FRAMEWORK` and
  103. :variable:`CMAKE_FIND_APPBUNDLE` variables determine the order of
  104. preference between Apple-style and unix-style package components.
  105. .. include:: FIND_XXX_ROOT.txt
  106. .. include:: FIND_XXX_ORDER.txt