2011-08-02 02:30:58 +04:00
|
|
|
# This module searches giflib and defines
|
2008-01-04 20:38:34 +03:00
|
|
|
# GIF_LIBRARIES - libraries to link to in order to use GIF
|
2011-07-27 22:32:59 +04:00
|
|
|
# GIF_FOUND, if false, do not try to link
|
2008-01-04 20:38:34 +03:00
|
|
|
# GIF_INCLUDE_DIR, where to find the headers
|
2011-08-02 02:30:58 +04:00
|
|
|
# GIF_VERSION, reports either version 4 or 3 (for everything before version 4)
|
|
|
|
#
|
|
|
|
# The minimum required version of giflib can be specified using the
|
2012-08-13 21:47:32 +04:00
|
|
|
# standard syntax, e.g. find_package(GIF 4)
|
2007-12-21 04:59:44 +03:00
|
|
|
#
|
2008-01-04 20:38:34 +03:00
|
|
|
# $GIF_DIR is an environment variable that would
|
|
|
|
# correspond to the ./configure --prefix=$GIF_DIR
|
|
|
|
|
2009-09-28 19:45:50 +04:00
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2007-2009 Kitware, Inc.
|
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:45:50 +04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
2011-07-27 22:32:59 +04:00
|
|
|
# Created by Eric Wing.
|
2008-01-04 20:38:34 +03:00
|
|
|
# Modifications by Alexander Neundorf
|
2007-12-21 04:59:44 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_path(GIF_INCLUDE_DIR gif_lib.h
|
2008-06-10 00:04:06 +04:00
|
|
|
HINTS
|
2008-01-04 20:38:34 +03:00
|
|
|
$ENV{GIF_DIR}
|
2007-12-21 04:59:44 +03:00
|
|
|
PATH_SUFFIXES include
|
|
|
|
PATHS
|
|
|
|
~/Library/Frameworks
|
2011-07-27 22:34:09 +04:00
|
|
|
/usr/freeware
|
2007-12-21 04:59:44 +03:00
|
|
|
)
|
|
|
|
|
2008-01-04 20:38:34 +03:00
|
|
|
# the gif library can have many names :-/
|
2012-08-13 21:47:32 +04:00
|
|
|
set(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib giflib4)
|
2008-01-04 20:38:34 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_library(GIF_LIBRARY
|
2008-01-04 20:38:34 +03:00
|
|
|
NAMES ${POTENTIAL_GIF_LIBS}
|
2008-06-10 00:04:06 +04:00
|
|
|
HINTS
|
2008-01-04 20:38:34 +03:00
|
|
|
$ENV{GIF_DIR}
|
2007-12-21 04:59:44 +03:00
|
|
|
PATH_SUFFIXES lib64 lib
|
|
|
|
PATHS
|
|
|
|
~/Library/Frameworks
|
|
|
|
/usr/freeware
|
|
|
|
)
|
|
|
|
|
2008-01-04 20:38:34 +03:00
|
|
|
# see readme.txt
|
2012-08-13 21:47:32 +04:00
|
|
|
set(GIF_LIBRARIES ${GIF_LIBRARY})
|
2007-12-21 04:59:44 +03:00
|
|
|
|
2011-08-02 02:30:58 +04:00
|
|
|
# Very basic version detection.
|
|
|
|
# The GIF_LIB_VERSION string in gif_lib.h seems to be unreliable, since it seems
|
|
|
|
# to be always " Version 2.0, " in versions 3.x of giflib.
|
|
|
|
# In version 4 the member UserData was added to GifFileType, so we check for this
|
|
|
|
# one.
|
|
|
|
# http://giflib.sourcearchive.com/documentation/4.1.4/files.html
|
2012-08-13 21:47:32 +04:00
|
|
|
if(GIF_INCLUDE_DIR)
|
|
|
|
include(CMakePushCheckState)
|
|
|
|
include(CheckStructHasMember)
|
2011-08-02 02:30:58 +04:00
|
|
|
CMAKE_PUSH_CHECK_STATE()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(GIF_VERSION 3)
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")
|
2011-08-02 02:30:58 +04:00
|
|
|
CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
|
2012-08-13 21:47:32 +04:00
|
|
|
if(GIF_GifFileType_UserData)
|
|
|
|
set(GIF_VERSION 4)
|
|
|
|
endif()
|
2011-08-02 02:30:58 +04:00
|
|
|
CMAKE_POP_CHECK_STATE()
|
2012-08-13 21:47:32 +04:00
|
|
|
endif()
|
2011-08-02 02:30:58 +04:00
|
|
|
|
|
|
|
|
2011-07-27 22:32:59 +04:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if
|
2008-01-04 20:38:34 +03:00
|
|
|
# all listed variables are TRUE
|
2012-08-13 21:47:32 +04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2011-08-02 02:30:58 +04:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR
|
|
|
|
VERSION_VAR GIF_VERSION )
|
2007-12-21 04:59:44 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY)
|