FindFontConfig.cmake
Go to the documentation of this file.
1 # - Find FontConfig library
2 # Find the FontConfig includes and library
3 # This module defines
4 # FONTCONFIG_INCLUDE_DIR, where to find fontconfig.h
5 # FONTCONFIG_LIBRARIES, libraries to link against to use the FontConfig API.
6 # FONTCONFIG_FOUND, If false, do not try to use FontConfig.
7 
8 #=============================================================================
9 # Copyright 2012 Kitware, Inc.
10 #
11 # Distributed under the OSI-approved BSD License (the "License");
12 # see accompanying file Copyright.txt for details.
13 #
14 # This software is distributed WITHOUT ANY WARRANTY; without even the
15 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 # See the License for more information.
17 #=============================================================================
18 # (To distribute this file outside of VTK, substitute the full
19 # License text for the above reference.)
20 
21 find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h)
22 
23 find_library(FONTCONFIG_LIBRARY NAMES fontconfig)
24 
25 # handle the QUIETLY and REQUIRED arguments and set FONTCONFIG_FOUND to TRUE if
26 # all listed variables are TRUE
27 include(FindPackageHandleStandardArgs)
28 find_package_handle_standard_args(FontConfig DEFAULT_MSG
29  FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)
30 
31 if(FONTCONFIG_FOUND)
32  if (NOT TARGET FontConfig::FontConfig)
33  add_library(FontConfig::FontConfig UNKNOWN IMPORTED)
34  set_target_properties(FontConfig::FontConfig PROPERTIES
35  IMPORTED_LOCATION "${FONTCONFIG_LIBRARY}"
36  INTERFACE_INCLUDE_DIRECTORIES "${FONTCONFIG_INCLUDE_DIR}")
37  endif ()
38  set( FONTCONFIG_LIBRARIES ${FONTCONFIG_LIBRARY} )
39 endif()
40 
41 mark_as_advanced(FONTCONFIG_INCLUDE_DIR FONTCONFIG_LIBRARY FONTCONFIG_LIBRARIES)