[Cmake-commits] CMake branch, next, updated. v3.6.0-866-gd960645
Brad King
brad.king at kitware.com
Fri Jul 15 09:13:37 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via d9606452ce72c28ea5fad450702ad732780b1a3e (commit)
via 0a6c227d6412b01cf2ca45cd21b90384e7fe99c3 (commit)
from 42b2616776dca55084ef1bb1d23507e6baa2726b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d9606452ce72c28ea5fad450702ad732780b1a3e
commit d9606452ce72c28ea5fad450702ad732780b1a3e
Merge: 42b2616 0a6c227
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 15 09:13:36 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jul 15 09:13:36 2016 -0400
Merge topic 'FindGIF-version' into next
0a6c227d FindGIF: Detect version from GIF 4.1.6 and above
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a6c227d6412b01cf2ca45cd21b90384e7fe99c3
commit 0a6c227d6412b01cf2ca45cd21b90384e7fe99c3
Author: Ben Campbell <ben at scumways.com>
AuthorDate: Wed Jul 13 15:05:47 2016 +1200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Jul 15 09:10:59 2016 -0400
FindGIF: Detect version from GIF 4.1.6 and above
GIF 4.1.6 introduced version macros in the header file. Use them
to get a full version.
Fixes #16196.
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 7bbb8cf..6fbe9e9 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -2,12 +2,18 @@
# FindGIF
# -------
#
+# This finds the GIF library (giflib)
#
+# The module defines the following variables:
#
-# 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)
+# ``GIF_FOUND``
+# True if giflib was found
+# ``GIF_LIBRARIES``
+# Libraries to link to in order to use giflib
+# ``GIF_INCLUDE_DIR``
+# where to find the headers
+# ``GIF_VERSION``
+# 3, 4 or a full version string (eg 5.1.4) for versions >= 4.1.6
#
# The minimum required version of giflib can be specified using the
# standard syntax, e.g. find_package(GIF 4)
@@ -29,7 +35,7 @@
# License text for the above reference.)
# Created by Eric Wing.
-# Modifications by Alexander Neundorf
+# Modifications by Alexander Neundorf, Ben Campbell
find_path(GIF_INCLUDE_DIR gif_lib.h
HINTS
@@ -61,22 +67,40 @@ set(GIF_LIBRARIES ${GIF_LIBRARY})
# 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
+# Versions after 4.1.6 define GIFLIB_MAJOR, GIFLIB_MINOR, and GIFLIB_RELEASE
+# see http://giflib.sourceforge.net/gif_lib.html#compatibility
if(GIF_INCLUDE_DIR)
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake)
CMAKE_PUSH_CHECK_STATE()
set(CMAKE_REQUIRED_QUIET ${GIF_FIND_QUIETLY})
- set(GIF_VERSION 3)
set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")
- CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
- if(GIF_GifFileType_UserData)
- set(GIF_VERSION 4)
+
+ # Check for the specific version defines (>=4.1.6 only)
+ file(STRINGS ${GIF_INCLUDE_DIR}/gif_lib.h _GIF_DEFS REGEX "^[ \t]*#define[ \t]+GIFLIB_(MAJOR|MINOR|RELEASE)")
+ if(_GIF_DEFS)
+ # yay - got exact version info
+ string(REGEX REPLACE ".*GIFLIB_MAJOR ([0-9]+).*" "\\1" _GIF_MAJ "${_GIF_DEFS}")
+ string(REGEX REPLACE ".*GIFLIB_MINOR ([0-9]+).*" "\\1" _GIF_MIN "${_GIF_DEFS}")
+ string(REGEX REPLACE ".*GIFLIB_RELEASE ([0-9]+).*" "\\1" _GIF_REL "${_GIF_DEFS}")
+ set(GIF_VERSION "${_GIF_MAJ}.${_GIF_MIN}.${_GIF_REL}")
+ else()
+ # use UserData field to sniff version instead
+ CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )
+ if(GIF_GifFileType_UserData)
+ set(GIF_VERSION 4)
+ else()
+ set(GIF_VERSION 3)
+ endif()
endif()
+
+ unset(_GIF_MAJ)
+ unset(_GIF_MIN)
+ unset(_GIF_REL)
+ unset(_GIF_DEFS)
CMAKE_POP_CHECK_STATE()
endif()
-
# handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-----------------------------------------------------------------------
Summary of changes:
Modules/FindGIF.cmake | 46 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 11 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list