1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-08 22:37:04 +08:00

FindFontconfig: Update documentation

- Synced module documentation with other similar find modules.
- Added examples section, highlighting the imported target usage.
This commit is contained in:
Peter Kokot 2025-04-08 23:31:27 +02:00
parent 1840c8c61b
commit c398e44450
No known key found for this signature in database
GPG Key ID: A94800907AA79B36

View File

@ -7,38 +7,51 @@ FindFontconfig
.. versionadded:: 3.14
Find Fontconfig headers and library.
Finds Fontconfig, a library for font configuration and customization.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following :ref:`Imported Targets`:
``Fontconfig::Fontconfig``
The Fontconfig library, if found.
Target encapsulating the Fontconfig usage requirements, available if
Fontconfig is found.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables in your project:
This module defines the following variables:
``Fontconfig_FOUND``
true if (the requested version of) Fontconfig is available.
Boolean indicating whether the (requested version of) Fontconfig is found.
``Fontconfig_VERSION``
the version of Fontconfig.
The version of Fontconfig found.
``Fontconfig_LIBRARIES``
the libraries to link against to use Fontconfig.
The libraries to link against to use Fontconfig.
``Fontconfig_INCLUDE_DIRS``
where to find the Fontconfig headers.
The include directories containing headers needed to use Fontconfig.
``Fontconfig_COMPILE_OPTIONS``
this should be passed to target_compile_options(), if the
target is not used for linking
Compiler options needed to use Fontconfig. These should be passed to
:command:`target_compile_options` when not using the
``Fontconfig::Fontconfig`` imported target.
Examples
^^^^^^^^
Finding Fontconfig and linking it to a project target:
.. code-block:: cmake
find_package(Fontconfig)
target_link_libraries(project_target PRIVATE Fontconfig::Fontconfig)
#]=======================================================================]
cmake_policy(PUSH)
cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PKG_FONTCONFIG QUIET fontconfig)