1 # - Locate FreeType library
3 # FREETYPE_LIBRARIES, libraries to link against
4 # FREETYPE_FOUND, if false, do not try to link to FREETYPE
5 # FREETYPE_INCLUDE_DIRS, where to find headers.
7 IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
9 SET(Freetype_FIND_QUIETLY TRUE)
12 FIND_PATH(FREETYPE_INCLUDE_DIRS
15 $ENV{FREETYPE_DIR}/include
22 PATH_SUFFIXES freetype2
25 IF(NOT FREETYPE_INCLUDE_DIRS)
26 SET(FREETYPE_INCLUDE_DIRS "")
29 # ft2build.h does not reside in the freetype include dir
30 FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
39 PATH_SUFFIXES freetype2
42 # combine both include directories into one variable
43 IF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
44 SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR})
47 FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE
48 NAMES freetype libfreetype freetype219 freetype246
50 $ENV{FREETYPE_DIR}/lib
60 /usr/lib/x86_64-linux-gnu
63 FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG
64 NAMES freetyped libfreetyped freetype219d freetype246d
66 $ENV{FREETYPE_DIR}/lib
76 /usr/lib/x86_64-linux-gnu
79 IF(FREETYPE_INCLUDE_DIRS)
80 IF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
81 # Case where both Release and Debug versions are provided
82 SET(FREETYPE_FOUND ON)
83 SET(FREETYPE_LIBRARIES optimized ${FREETYPE_LIBRARY_RELEASE} debug ${FREETYPE_LIBRARY_DEBUG})
84 ELSEIF(FREETYPE_LIBRARY_RELEASE)
86 SET(FREETYPE_FOUND ON)
87 SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_RELEASE})
88 ELSEIF(FREETYPE_LIBRARY_DEBUG)
89 # Case where Freetype is compiled from sources (debug version is compiled by default)
90 SET(FREETYPE_FOUND ON)
91 SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG})
96 IF(WITH_STATIC_EXTERNAL AND APPLE)
99 SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR})
100 SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES})
103 IF(NOT Freetype_FIND_QUIETLY)
104 MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}")
107 IF(NOT Freetype_FIND_QUIETLY)
108 MESSAGE(STATUS "Warning: Unable to find FreeType!")