| 1 | # - Locate FreeType library |
|---|
| 2 | # This module defines |
|---|
| 3 | # FREETYPE_LIBRARY, 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 |
|---|
| 9 | # |
|---|
| 10 | # $FREETYPE_DIR is an environment variable that would |
|---|
| 11 | # correspond to the ./configure --prefix=$FREETYPE_DIR |
|---|
| 12 | # used in building FREETYPE. |
|---|
| 13 | # Created by Eric Wing. |
|---|
| 14 | |
|---|
| 15 | # Ugh, FreeType seems to use some #include trickery which |
|---|
| 16 | # makes this harder than it should be. It looks like they |
|---|
| 17 | # put ft2build.h in a common/easier-to-find location which |
|---|
| 18 | # then contains a #include to a more specific header in a |
|---|
| 19 | # more specific location (#include <freetype/config/ftheader.h>). |
|---|
| 20 | # Then from there, they need to set a bunch of #define's |
|---|
| 21 | # so you can do something like: |
|---|
| 22 | # #include FT_FREETYPE_H |
|---|
| 23 | # Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES() |
|---|
| 24 | # wants explicit full paths and this trickery doesn't work too well. |
|---|
| 25 | # I'm going to attempt to cut out the middleman and hope |
|---|
| 26 | # everything still works. |
|---|
| 27 | FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h |
|---|
| 28 | # $ENV{FREETYPE_DIR} |
|---|
| 29 | /usr/local/include |
|---|
| 30 | /usr/include |
|---|
| 31 | /usr/local/X11R6 |
|---|
| 32 | /usr/X11R6/include |
|---|
| 33 | /sw/include |
|---|
| 34 | /opt/local/include |
|---|
| 35 | /opt/csw/include |
|---|
| 36 | /opt/include |
|---|
| 37 | /usr/freeware/include/freetype2 |
|---|
| 38 | ) |
|---|
| 39 | |
|---|
| 40 | FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h |
|---|
| 41 | # $ENV{FREETYPE_DIR}/include/freetype2 |
|---|
| 42 | /usr/local/include/freetype2 |
|---|
| 43 | /usr/include/freetype2 |
|---|
| 44 | /usr/local/X11R6/include/freetype2 |
|---|
| 45 | /usr/X11R6/include/freetype2 |
|---|
| 46 | /sw/include/freetype2 |
|---|
| 47 | /opt/local/include/freetype2 |
|---|
| 48 | /opt/csw/include/freetype2 |
|---|
| 49 | /opt/include/freetype2 |
|---|
| 50 | /usr/freeware/include/freetype2 |
|---|
| 51 | ) |
|---|
| 52 | |
|---|
| 53 | FIND_LIBRARY(FREETYPE_LIBRARY |
|---|
| 54 | NAMES freetype libfreetype freetype219 |
|---|
| 55 | PATHS |
|---|
| 56 | # $ENV{FREETYPE_DIR}/lib |
|---|
| 57 | # $ENV{FREETYPE_DIR}/lib |
|---|
| 58 | /usr/local/lib |
|---|
| 59 | /usr/lib |
|---|
| 60 | /usr/local/X11R6/lib |
|---|
| 61 | /usr/X11R6/lib |
|---|
| 62 | /sw/lib |
|---|
| 63 | /opt/local/lib |
|---|
| 64 | /opt/csw/lib |
|---|
| 65 | /opt/lib |
|---|
| 66 | /usr/freeware/lib64 |
|---|
| 67 | ) |
|---|
| 68 | |
|---|
| 69 | IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) |
|---|
| 70 | SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}") |
|---|
| 71 | ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | SET(FREETYPE_FOUND "NO") |
|---|
| 75 | IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) |
|---|
| 76 | SET(FREETYPE_FOUND "YES") |
|---|
| 77 | ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) |
|---|
| 78 | |
|---|
| 79 | |
|---|