Merge topic 'FindFreetype-2.5'

9b08e3f FindFreetype: Remove duplicates in FREETYPE_INCLUDE_DIRS
bc49d82 FindFreetype: Detect version string with Freetype 2.5
7435ae7 FindFreetype: Find ftheader.h with Freetype 2.5
This commit is contained in:
Brad King 2013-12-19 10:12:25 -05:00 committed by CMake Topic Stage
commit 172f37be33
1 changed files with 13 additions and 3 deletions

View File

@ -65,7 +65,10 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
PATH_SUFFIXES include/freetype2 include PATH_SUFFIXES include/freetype2 include
) )
find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h find_path(FREETYPE_INCLUDE_DIR_freetype2
NAMES
freetype/config/ftheader.h
config/ftheader.h
HINTS HINTS
ENV FREETYPE_DIR ENV FREETYPE_DIR
PATHS PATHS
@ -97,11 +100,18 @@ find_library(FREETYPE_LIBRARY
# set the user variables # set the user variables
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}") set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
endif() endif()
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}") set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
if(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
file(STRINGS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h" freetype_version_str set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
endif()
if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
file(STRINGS "${FREETYPE_H}" freetype_version_str
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$") REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
unset(FREETYPE_VERSION_STRING) unset(FREETYPE_VERSION_STRING)