1find_library 2------------ 3 4.. |FIND_XXX| replace:: find_library 5.. |NAMES| replace:: NAMES name1 [name2 ...] [NAMES_PER_DIR] 6.. |SEARCH_XXX| replace:: library 7.. |SEARCH_XXX_DESC| replace:: library 8.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/lib`` 9.. |entry_XXX_SUBDIR| replace:: ``<entry>/lib`` 10 11.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| replace:: 12 ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, 13 and |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| 14.. |CMAKE_PREFIX_PATH_XXX| replace:: 15 ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, 16 and |CMAKE_PREFIX_PATH_XXX_SUBDIR| 17.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_LIBRARY_PATH` 18.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` 19 20.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``LIB`` 21 and ``PATH``. 22.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts: 23 ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` 24 is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|. 25 26.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: 27 ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, 28 and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| 29.. |CMAKE_SYSTEM_XXX_PATH| replace:: 30 :variable:`CMAKE_SYSTEM_LIBRARY_PATH` 31.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: 32 :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` 33 34.. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: 35 :variable:`CMAKE_FIND_ROOT_PATH_MODE_LIBRARY` 36 37.. include:: FIND_XXX.txt 38 39When more than one value is given to the ``NAMES`` option this command by 40default will consider one name at a time and search every directory 41for it. The ``NAMES_PER_DIR`` option tells this command to consider one 42directory at a time and search for all names in it. 43 44Each library name given to the ``NAMES`` option is first considered 45as a library file name and then considered with platform-specific 46prefixes (e.g. ``lib``) and suffixes (e.g. ``.so``). Therefore one 47may specify library file names such as ``libfoo.a`` directly. 48This can be used to locate static libraries on UNIX-like systems. 49 50If the library found is a framework, then ``<VAR>`` will be set to the full 51path to the framework ``<fullPath>/A.framework``. When a full path to a 52framework is used as a library, CMake will use a ``-framework A``, and a 53``-F<fullPath>`` to link the framework to the target. 54 55If the :variable:`CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX` variable is set all 56search paths will be tested as normal, with the suffix appended, and with 57all matches of ``lib/`` replaced with 58``lib${CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}/``. This variable overrides 59the :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS`, 60:prop_gbl:`FIND_LIBRARY_USE_LIBX32_PATHS`, 61and :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` global properties. 62 63If the :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS` global property is set 64all search paths will be tested as normal, with ``32/`` appended, and 65with all matches of ``lib/`` replaced with ``lib32/``. This property is 66automatically set for the platforms that are known to need it if at 67least one of the languages supported by the :command:`project` command 68is enabled. 69 70If the :prop_gbl:`FIND_LIBRARY_USE_LIBX32_PATHS` global property is set 71all search paths will be tested as normal, with ``x32/`` appended, and 72with all matches of ``lib/`` replaced with ``libx32/``. This property is 73automatically set for the platforms that are known to need it if at 74least one of the languages supported by the :command:`project` command 75is enabled. 76 77If the :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` global property is set 78all search paths will be tested as normal, with ``64/`` appended, and 79with all matches of ``lib/`` replaced with ``lib64/``. This property is 80automatically set for the platforms that are known to need it if at 81least one of the languages supported by the :command:`project` command 82is enabled. 83