From eed9b1b0dac484eea807ac3bb07051b69b94af6b Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Fri, 4 Jan 2008 12:38:34 -0500 Subject: [PATCH] ENH: rename variables from GIFLIB_* to GIF_* -add standard QUIET and REQUIRED handling -add GIF_LIBRARIES variable as readme.txt says -add name giflib to the names for the gif library -remove some unnecessary search paths for the lib (they are already part of the standard search paths, see Modules/Platform/UnixPaths.cmake) -FindFreetype.cmake: use PATH_SUFFIXES include again for the headers with the CMAKE_PREFIX_PATH variable Alex --- Modules/FindFreetype.cmake | 21 +++++++------- Modules/FindGIF.cmake | 56 ++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index c37fce16f..0639cdda1 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -10,7 +10,11 @@ # $FREETYPE_DIR is an environment variable that would # correspond to the ./configure --prefix=$FREETYPE_DIR # used in building FREETYPE. + # Created by Eric Wing. +# Modifications by Alexander Neundorf. +# This file has been renamed to "FindFreetype.cmake" instead of the correct +# "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex. # Ugh, FreeType seems to use some #include trickery which # makes this harder than it should be. It looks like they @@ -27,11 +31,12 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h $ENV{FREETYPE_DIR} NO_DEFAULT_PATH - PATH_SUFFIXES include + PATH_SUFFIXES include ) FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h - PATHS ${CMAKE_PREFIX_PATH}/include # Unofficial: We are proposing this. + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. NO_DEFAULT_PATH + PATH_SUFFIXES include ) FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h @@ -49,9 +54,9 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h NO_DEFAULT_PATH ) FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h - PATHS ${CMAKE_PREFIX_PATH}/include # Unofficial: We are proposing this. + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. NO_DEFAULT_PATH - PATH_SUFFIXES freetype2 + PATH_SUFFIXES include/freetype2 ) FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h /usr/local/X11R6/include @@ -79,16 +84,10 @@ FIND_LIBRARY(FREETYPE_LIBRARY FIND_LIBRARY(FREETYPE_LIBRARY NAMES freetype libfreetype freetype219 PATHS - /usr/local - /usr /usr/local/X11R6 /usr/local/X11 - /usr/X11R6 /usr/X11 /sw - /opt/local - /opt/csw - /opt /usr/freeware PATH_SUFFIXES lib64 lib ) @@ -99,7 +98,7 @@ IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}") -# handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS) diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index b2b2f23c1..320cdb6f6 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -1,57 +1,56 @@ # This module defines -# GIFLIB_LIBRARY -# GIFLIB_FOUND, if false, do not try to link -# GIFLIB_INCLUDE_DIR, where to find the headers +# GIF_LIBRARIES - libraries to link to in order to use GIF +# GIF_FOUND, if false, do not try to link +# GIF_INCLUDE_DIR, where to find the headers # -# $GIFLIB_DIR is an environment variable that would -# correspond to the ./configure --prefix=$GIFLIB_DIR -# -# Created by Eric Wing. +# $GIF_DIR is an environment variable that would +# correspond to the ./configure --prefix=$GIF_DIR -FIND_PATH(GIFLIB_INCLUDE_DIR gif_lib.h +# Created by Eric Wing. +# Modifications by Alexander Neundorf + +FIND_PATH(GIF_INCLUDE_DIR gif_lib.h PATHS - $ENV{GIFLIB_DIR} + $ENV{GIF_DIR} NO_DEFAULT_PATH PATH_SUFFIXES include ) -FIND_PATH(GIFLIB_INCLUDE_DIR gif_lib.h +FIND_PATH(GIF_INCLUDE_DIR gif_lib.h PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. NO_DEFAULT_PATH PATH_SUFFIXES include ) -FIND_PATH(GIFLIB_INCLUDE_DIR gif_lib.h +FIND_PATH(GIF_INCLUDE_DIR gif_lib.h PATHS ~/Library/Frameworks /Library/Frameworks - /usr/local/include - /usr/include /sw/include # Fink - /opt/local/include # DarwinPorts - /opt/csw/include # Blastwave - /opt/include [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include /usr/freeware/include ) -FIND_LIBRARY(GIFLIB_LIBRARY - NAMES gif ungif libgif libungif +# the gif library can have many names :-/ +SET(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib) + +FIND_LIBRARY(GIF_LIBRARY + NAMES ${POTENTIAL_GIF_LIBS} PATHS - $ENV{GIFLIB_DIR} + $ENV{GIF_DIR} NO_DEFAULT_PATH PATH_SUFFIXES lib64 lib ) -FIND_LIBRARY(GIFLIB_LIBRARY - NAMES gif ungif libgif libungif +FIND_LIBRARY(GIF_LIBRARY + NAMES ${POTENTIAL_GIF_LIBS} PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. NO_DEFAULT_PATH PATH_SUFFIXES lib64 lib ) -FIND_LIBRARY(GIFLIB_LIBRARY - NAMES gif ungif libgif libungif +FIND_LIBRARY(GIF_LIBRARY + NAMES ${POTENTIAL_GIF_LIBS} PATHS ~/Library/Frameworks /Library/Frameworks @@ -66,9 +65,12 @@ FIND_LIBRARY(GIFLIB_LIBRARY PATH_SUFFIXES lib64 lib ) -SET(GIFLIB_FOUND "NO") -IF(GIFLIB_LIBRARY AND GIFLIB_INCLUDE_DIR) - SET(GIFLIB_FOUND "YES") -ENDIF(GIFLIB_LIBRARY AND GIFLIB_INCLUDE_DIR) +# see readme.txt +SET(GIF_LIBRARIES ${GIF_LIBRARY}) +# handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF DEFAULT_MSG GIF_LIBRARY GIF_INCLUDE_DIR) +MARK_AS_ADVANCED(GIF_INCLUDE_DIR GIF_LIBRARY)