File: FindFontConfig.cmake

package info (click to toggle)
forge 1.0.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,312 kB
  • sloc: cpp: 12,447; ansic: 319; xml: 182; makefile: 19
file content (59 lines) | stat: -rw-r--r-- 1,905 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#sourced from
#https://github.com/rougier/freetype-gl/blob/master/CMakeModules/FindFontConfig.cmake

# - Try to find Fontconfig
# Once done this will define
#
#  FONTCONFIG_FOUND - system has Fontconfig
#  FONTCONFIG_INCLUDE_DIR - the Fontconfig include directory
#  FONTCONFIG_LIBRARY - Link these to use Fontconfig
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

IF ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
    # in cache already
    SET(Fontconfig_FIND_QUIETLY TRUE)
ENDIF ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )

# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
IF (NOT WIN32)
    FIND_PACKAGE(PkgConfig)

    pkg_check_modules(FONTCONFIG_PKG QUIET fontconfig)
ENDIF (NOT WIN32)

FIND_PATH(FONTCONFIG_INCLUDE_DIR NAMES fontconfig/fontconfig.h
    PATHS
    /usr/local/include
    /usr/X11/include
    /usr/include
    HINTS
    ${FONTCONFIG_PKG_INCLUDE_DIRS} # Generated by pkg-config
    )

IF (DEFINED FONTCONFIG_INCLUDE_DIR-NOTFOUND)
    MESSAGE(FATAL_ERROR "FontConfig header files not found")
ENDIF (DEFINED FONTCONFIG_INCLUDE_DIR-NOTFOUND)

FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig ${FONTCONFIG_PKG_LIBRARY}
    PATHS
    /usr/local
    /usr/X11
    /usr
    HINTS
    ${FONTCONFIG_PKG_LIBRARY_DIRS} # Generated by pkg-config
    PATH_SUFFIXES
    lib64
    lib
    )

IF (DEFINED FONTCONFIG_LIBRARY-NOTFOUND)
    MESSAGE(FATAL_ERROR "FontConfig library files not found")
ENDIF (DEFINED FONTCONFIG_LIBRARY-NOTFOUND)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)

# show the FONTCONFIG_INCLUDE_DIR and FONTCONFIG_LIBRARY variables only in the advanced view
MARK_AS_ADVANCED(FONTCONFIG_INCLUDE_DIR FONTCONFIG_LIBRARY)