aboutsummaryrefslogtreecommitdiff
path: root/modules/FindFreetype.cmake
blob: 8a11dc4040f2897392774085225ea9cddf4541be (plain)
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
# - Try to find the freetype library
# Once done this will define
#
#  FREETYPE_FOUND - system has Fontconfig
#  FREETYPE_INCLUDE_DIR - the FONTCONFIG include directory
#  FREETYPE_LIBRARIES - Link these to use FREETYPE
#

if (FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)

  # in cache already
  set(FREETYPE_FOUND TRUE)

else (FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)

  FIND_PROGRAM(FREETYPECONFIG_EXECUTABLE NAMES freetype-config PATHS
     /usr/bin
     /usr/local/bin
     /opt/local/bin
  )

  #reset vars
  set(FREETYPE_LIBRARIES)
  set(FREETYPE_INCLUDE_DIR)

  # if freetype-config has been found
  if(FREETYPECONFIG_EXECUTABLE)

    EXEC_PROGRAM(${FREETYPECONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE FREETYPE_LIBRARIES)

    EXEC_PROGRAM(${FREETYPECONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE FREETYPE_INCLUDE_DIR)
    if(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)
      set(FREETYPE_FOUND TRUE)
      #message(STATUS "Found freetype: ${FREETYPE_LIBRARIES}")
    endif(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)

    MARK_AS_ADVANCED(FREETYPE_LIBRARIES FREETYPE_INCLUDE_DIR)

    set( FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} CACHE INTERNAL "The libraries for freetype" )

  endif(FREETYPECONFIG_EXECUTABLE)

endif (FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)