diff --git a/Modules/FindFontconfig.cmake b/Modules/FindFontconfig.cmake index a4546fdd35..218ad2fbfa 100644 --- a/Modules/FindFontconfig.cmake +++ b/Modules/FindFontconfig.cmake @@ -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_ # 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)