Skip to content

Commit

Permalink
Fix freetype detection
Browse files Browse the repository at this point in the history
Don't reinvent freetype detection, use working one from cmake.
  • Loading branch information
AMDmi3 authored and kwolekr committed Apr 8, 2015
1 parent 0df7361 commit d2fc98e
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions src/CMakeLists.txt
Expand Up @@ -111,23 +111,30 @@ option(ENABLE_FREETYPE "Enable FreeType2 (TrueType fonts and basic unicode suppo
set(USE_FREETYPE FALSE)

if(ENABLE_FREETYPE)
if(UNIX)
include(FindPkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(FREETYPE QUIET freetype2)
if(FREETYPE_FOUND)
SET(FREETYPE_PKGCONFIG_FOUND TRUE)
SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES})
# Because CMake is idiotic
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()
##
## Note: FindFreetype.cmake seems to have been fixed in recent versions of
## CMake. If issues persist, re-enable this workaround specificially for the
## failing platforms.
##
# if(UNIX)
# include(FindPkgConfig)
# if(PKG_CONFIG_FOUND)
# pkg_check_modules(FREETYPE QUIET freetype2)
# if(FREETYPE_FOUND)
# SET(FREETYPE_PKGCONFIG_FOUND TRUE)
# SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES})
# # Because CMake is idiotic
# 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)
if(FREETYPE_FOUND)
message(STATUS "Freetype enabled.")
set(USE_FREETYPE TRUE)
set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont")
set(CGUITTFONT_LIBRARY cguittfont)
Expand Down

0 comments on commit d2fc98e

Please sign in to comment.