Fix freetype detection

Don't reinvent freetype detection, use working one from cmake.
master
Dmitry Marakasov 2015-04-08 00:32:09 -04:00 committed by kwolekr
parent 0df736173e
commit d2fc98e4a6
1 changed files with 23 additions and 16 deletions

View File

@ -111,23 +111,30 @@ option(ENABLE_FREETYPE "Enable FreeType2 (TrueType fonts and basic unicode suppo
set(USE_FREETYPE FALSE) set(USE_FREETYPE FALSE)
if(ENABLE_FREETYPE) if(ENABLE_FREETYPE)
if(UNIX) ##
include(FindPkgConfig) ## Note: FindFreetype.cmake seems to have been fixed in recent versions of
if(PKG_CONFIG_FOUND) ## CMake. If issues persist, re-enable this workaround specificially for the
pkg_check_modules(FREETYPE QUIET freetype2) ## failing platforms.
if(FREETYPE_FOUND) ##
SET(FREETYPE_PKGCONFIG_FOUND TRUE) # if(UNIX)
SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES}) # include(FindPkgConfig)
# Because CMake is idiotic # if(PKG_CONFIG_FOUND)
string(REPLACE ";" " " FREETYPE_CFLAGS_STR ${FREETYPE_CFLAGS}) # pkg_check_modules(FREETYPE QUIET freetype2)
string(REPLACE ";" " " FREETYPE_LDFLAGS_STR ${FREETYPE_LDFLAGS}) # if(FREETYPE_FOUND)
endif(FREETYPE_FOUND) # SET(FREETYPE_PKGCONFIG_FOUND TRUE)
endif(PKG_CONFIG_FOUND) # SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES})
endif(UNIX) # # Because CMake is idiotic
if(NOT FREETYPE_FOUND) # string(REPLACE ";" " " FREETYPE_CFLAGS_STR ${FREETYPE_CFLAGS})
# string(REPLACE ";" " " FREETYPE_LDFLAGS_STR ${FREETYPE_LDFLAGS})
# endif(FREETYPE_FOUND)
# endif(PKG_CONFIG_FOUND)
# endif(UNIX)
# if(NOT FREETYPE_FOUND)
# find_package(Freetype)
# endif()
find_package(Freetype) find_package(Freetype)
endif()
if(FREETYPE_FOUND) if(FREETYPE_FOUND)
message(STATUS "Freetype enabled.")
set(USE_FREETYPE TRUE) set(USE_FREETYPE TRUE)
set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont") set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont")
set(CGUITTFONT_LIBRARY cguittfont) set(CGUITTFONT_LIBRARY cguittfont)