From d5baba13e81a912996ae547b52ec5e30b1ebbd20 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 8 Sep 2013 10:26:23 +0200 Subject: [PATCH] Changed: Look for Debug version of freetype and use it for Debug configuration --- code/CMakeModules/FindFreeType.cmake | 59 +++++++++++++++++++++------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/code/CMakeModules/FindFreeType.cmake b/code/CMakeModules/FindFreeType.cmake index 4f3c84cbe..e15f55793 100644 --- a/code/CMakeModules/FindFreeType.cmake +++ b/code/CMakeModules/FindFreeType.cmake @@ -1,14 +1,13 @@ # - Locate FreeType library # This module defines -# FREETYPE_LIBRARY, the library to link against +# FREETYPE_LIBRARIES, libraries to link against # FREETYPE_FOUND, if false, do not try to link to FREETYPE # FREETYPE_INCLUDE_DIRS, where to find headers. -IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) +IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS) # in cache already - SET(FREETYPE_FIND_QUIETLY TRUE) -ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - + SET(Freetype_FIND_QUIETLY TRUE) +ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS) FIND_PATH(FREETYPE_INCLUDE_DIRS freetype @@ -40,7 +39,7 @@ IF(FREETYPE_ADDITIONAL_INCLUDE_DIR) SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR}) ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR) -FIND_LIBRARY(FREETYPE_LIBRARY +FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE NAMES freetype libfreetype freetype219 freetype246 PATHS $ENV{FREETYPE_DIR}/lib @@ -55,20 +54,50 @@ FIND_LIBRARY(FREETYPE_LIBRARY /usr/freeware/lib64 ) -IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - SET(FREETYPE_FOUND "YES") +FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG + NAMES freetyped libfreetyped freetype219d freetype246d + PATHS + $ENV{FREETYPE_DIR}/lib + /usr/local/lib + /usr/lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) + +IF(FREETYPE_INCLUDE_DIRS) + IF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG) + # Case where both Release and Debug versions are provided + SET(FREETYPE_FOUND ON) + SET(FREETYPE_LIBRARIES optimized ${FREETYPE_LIBRARY_RELEASE} debug ${FREETYPE_LIBRARY_DEBUG}) + ELSEIF(FREETYPE_LIBRARY_RELEASE) + # Normal case + SET(FREETYPE_FOUND ON) + SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_RELEASE}) + ELSEIF(FREETYPE_LIBRARY_DEBUG) + # Case where Freetype is compiled from sources (debug version is compiled by default) + SET(FREETYPE_FOUND ON) + SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG}) + ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG) +ENDIF(FREETYPE_INCLUDE_DIRS) + +IF(FREETYPE_FOUND) IF(WITH_STATIC_EXTERNAL AND APPLE) FIND_PACKAGE(BZip2) IF(BZIP2_FOUND) SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR}) - SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARY} ${BZIP2_LIBRARIES}) + SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES}) ENDIF(BZIP2_FOUND) ENDIF(WITH_STATIC_EXTERNAL AND APPLE) - IF(NOT FREETYPE_FIND_QUIETLY) - MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARY}") - ENDIF(NOT FREETYPE_FIND_QUIETLY) + IF(NOT Freetype_FIND_QUIETLY) + MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}") + ENDIF(NOT Freetype_FIND_QUIETLY) ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - IF(NOT FREETYPE_FIND_QUIETLY) + IF(NOT Freetype_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find FreeType!") - ENDIF(NOT FREETYPE_FIND_QUIETLY) -ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) + ENDIF(NOT Freetype_FIND_QUIETLY) +ENDIF(FREETYPE_FOUND)