Merge topic 'FindFreetype-updates'

58f7baab FindFreetype: Indent with 2 spaces instead of 4
444f8801 FindFreetype: Use lower-case name in call to FPHSA
836a28d5 FindFreetype: Move PATH_SUFFIXES argument for more consistency
4ad6dace FindFreetype: Add newlines to reduce code width
This commit is contained in:
Brad King 2014-05-28 12:34:35 -04:00 committed by CMake Topic Stage
commit ca2b012cb9
1 changed files with 48 additions and 25 deletions

View File

@ -51,7 +51,9 @@
# wants explicit full paths and this trickery doesn't work too well.
# I'm going to attempt to cut out the middleman and hope
# everything still works.
find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
find_path(
FREETYPE_INCLUDE_DIR_ft2build
ft2build.h
HINTS
ENV FREETYPE_DIR
PATHS
@ -62,10 +64,14 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES include/freetype2 include freetype2
PATH_SUFFIXES
include/freetype2
include
freetype2
)
find_path(FREETYPE_INCLUDE_DIR_freetype2
find_path(
FREETYPE_INCLUDE_DIR_freetype2
NAMES
freetype/config/ftheader.h
config/ftheader.h
@ -79,14 +85,19 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES include/freetype2 include freetype2
PATH_SUFFIXES
include/freetype2
include
freetype2
)
find_library(FREETYPE_LIBRARY
NAMES freetype libfreetype freetype219
NAMES
freetype
libfreetype
freetype219
HINTS
ENV FREETYPE_DIR
PATH_SUFFIXES lib
PATHS
/usr/X11R6
/usr/local/X11R6
@ -95,6 +106,8 @@ find_library(FREETYPE_LIBRARY
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES
lib
)
# set the user variables
@ -111,31 +124,41 @@ elseif(EXISTS "${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]+$")
file(STRINGS "${FREETYPE_H}" freetype_version_str
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
unset(FREETYPE_VERSION_STRING)
foreach(VPART MAJOR MINOR PATCH)
foreach(VLINE ${freetype_version_str})
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
if(FREETYPE_VERSION_STRING)
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
else()
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
endif()
unset(FREETYPE_VERSION_PART)
endif()
endforeach()
unset(FREETYPE_VERSION_STRING)
foreach(VPART MAJOR MINOR PATCH)
foreach(VLINE ${freetype_version_str})
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
if(FREETYPE_VERSION_STRING)
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
else()
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
endif()
unset(FREETYPE_VERSION_PART)
endif()
endforeach()
endforeach()
endif()
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype
REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS
VERSION_VAR FREETYPE_VERSION_STRING)
mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build)
find_package_handle_standard_args(
Freetype
REQUIRED_VARS
FREETYPE_LIBRARY
FREETYPE_INCLUDE_DIRS
VERSION_VAR
FREETYPE_VERSION_STRING
)
mark_as_advanced(
FREETYPE_LIBRARY
FREETYPE_INCLUDE_DIR_freetype2
FREETYPE_INCLUDE_DIR_ft2build
)