2013-10-15 11:17:36 -04:00
|
|
|
#.rst:
|
|
|
|
# FindGIF
|
|
|
|
# -------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This module searches giflib and defines 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 GIF_VERSION, reports either
|
|
|
|
# version 4 or 3 (for everything before version 4)
|
2011-08-02 00:30:58 +02:00
|
|
|
#
|
|
|
|
# The minimum required version of giflib can be specified using the
|
2013-10-15 11:17:36 -04:00
|
|
|
# standard syntax, e.g. find_package(GIF 4)
|
2007-12-20 20:59:44 -05:00
|
|
|
#
|
2013-10-15 11:17:36 -04:00
|
|
|
# $GIF_DIR is an environment variable that would correspond to the
|
|
|
|
# ./configure --prefix=$GIF_DIR
|
2008-01-04 12:38:34 -05:00
|
|
|
|
2009-09-28 11: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-06 17:48:47 -07:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 11:45:50 -04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
2011-07-27 20:32:59 +02:00
|
|
|
# Created by Eric Wing.
|
2008-01-04 12:38:34 -05:00
|
|
|
# Modifications by Alexander Neundorf
|
2007-12-20 20:59:44 -05:00
|
|
|
|
2012-08-13 13:47:32 -04:00
|
|
|
find_path(GIF_INCLUDE_DIR gif_lib.h
|
2008-06-09 16:04:06 -04:00
|
|
|
HINTS
|
2012-03-29 00:00:54 +02:00
|
|
|
ENV GIF_DIR
|
2007-12-20 20:59:44 -05:00
|
|
|
PATH_SUFFIXES include
|
|
|
|
PATHS
|
|
|
|
~/Library/Frameworks
|
2011-07-27 20:34:09 +02:00
|
|
|
/usr/freeware
|
2007-12-20 20:59:44 -05:00
|
|
|
)
|
|
|
|
|
2008-01-04 12:38:34 -05:00
|
|
|
# the gif library can have many names :-/
|
2012-08-13 13:47:32 -04:00
|
|
|
set(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib giflib4)
|
2008-01-04 12:38:34 -05:00
|
|
|
|
2012-08-13 13:47:32 -04:00
|
|
|
find_library(GIF_LIBRARY
|
2008-01-04 12:38:34 -05:00
|
|
|
NAMES ${POTENTIAL_GIF_LIBS}
|
2008-06-09 16:04:06 -04:00
|
|
|
HINTS
|
2012-03-29 00:00:54 +02:00
|
|
|
ENV GIF_DIR
|
2012-03-29 00:51:06 +02:00
|
|
|
PATH_SUFFIXES lib
|
2007-12-20 20:59:44 -05:00
|
|
|
PATHS
|
|
|
|
~/Library/Frameworks
|
|
|
|
/usr/freeware
|
|
|
|
)
|
|
|
|
|
2008-01-04 12:38:34 -05:00
|
|
|
# see readme.txt
|
2012-08-13 13:47:32 -04:00
|
|
|
set(GIF_LIBRARIES ${GIF_LIBRARY})
|
2007-12-20 20:59:44 -05:00
|
|
|
|
2011-08-02 00:30:58 +02: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 13:47:32 -04:00
|
|
|
if(GIF_INCLUDE_DIR)
|
2012-11-03 21:35:44 +01:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake)
|
2011-08-02 00:30:58 +02:00
|
|
|
CMAKE_PUSH_CHECK_STATE()
|
2014-03-29 20:22:54 -06:00
|
|
|
set(CMAKE_REQUIRED_QUIET ${GIF_FIND_QUIETLY})
|
2012-08-13 13:47:32 -04:00
|
|
|
set(GIF_VERSION 3)
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")
|
2011-08-02 00:30:58 +02:00
|
|
|
CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
|
2012-08-13 13:47:32 -04:00
|
|
|
if(GIF_GifFileType_UserData)
|
|
|
|
set(GIF_VERSION 4)
|
|
|
|
endif()
|
2011-08-02 00:30:58 +02:00
|
|
|
CMAKE_POP_CHECK_STATE()
|
2012-08-13 13:47:32 -04:00
|
|
|
endif()
|
2011-08-02 00:30:58 +02:00
|
|
|
|
|
|
|
|
2011-07-27 20:32:59 +02:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if
|
2008-01-04 12:38:34 -05:00
|
|
|
# all listed variables are TRUE
|
2012-08-13 13:47:32 -04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2011-08-02 00:30:58 +02:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR
|
|
|
|
VERSION_VAR GIF_VERSION )
|
2007-12-20 20:59:44 -05:00
|
|
|
|
2012-08-13 13:47:32 -04:00
|
|
|
mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY)
|