1 # - Locate FreeType library
3 # FREETYPE_LIBRARIES, the library to link against
4 # FREETYPE_FOUND, if false, do not try to link to FREETYPE
5 # FREETYPE_INCLUDE_DIRS, where to find headers.
6 # This is the concatenation of the paths:
7 # FREETYPE_INCLUDE_DIR_ft2build
8 # FREETYPE_INCLUDE_DIR_freetype2
10 # $FREETYPE_DIR is an environment variable that would
11 # correspond to the ./configure --prefix=$FREETYPE_DIR
12 # used in building FREETYPE.
14 # Created by Eric Wing.
15 # Modifications by Alexander Neundorf.
16 # This file has been renamed to "FindFreetype.cmake" instead of the correct
17 # "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex.
19 # Ugh, FreeType seems to use some #include trickery which
20 # makes this harder than it should be. It looks like they
21 # put ft2build.h in a common/easier-to-find location which
22 # then contains a #include to a more specific header in a
23 # more specific location (#include <freetype/config/ftheader.h>).
24 # Then from there, they need to set a bunch of #define's
25 # so you can do something like:
26 # #include FT_FREETYPE_H
27 # Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES()
28 # wants explicit full paths and this trickery doesn't work too well.
29 # I'm going to attempt to cut out the middleman and hope
30 # everything still works.
31 FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
36 /usr/local/X11R6/include
37 /usr/local/X11/include
44 FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
46 $ENV{FREETYPE_DIR}/include/freetype2
48 /usr/local/X11R6/include
49 /usr/local/X11/include
54 PATH_SUFFIXES freetype2
57 FIND_LIBRARY(FREETYPE_LIBRARY
58 NAMES freetype libfreetype freetype219
61 PATH_SUFFIXES lib64 lib
70 # set the user variables
71 IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
72 SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
73 ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
74 SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
76 # handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
77 # all listed variables are TRUE
78 INCLUDE(FindPackageHandleStandardArgs)
79 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)
82 MARK_AS_ADVANCED(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build)