From c398e44450f445c336e2eb6b3287f38c72b42535 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Tue, 8 Apr 2025 23:31:27 +0200 Subject: FindFontconfig: Update documentation - Synced module documentation with other similar find modules. - Added examples section, highlighting the imported target usage. --- Modules/FindFontconfig.cmake | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/Modules/FindFontconfig.cmake b/Modules/FindFontconfig.cmake index a4546fd..218ad2f 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) -- cgit v0.12