[Cmake-commits] CMake branch, next, updated. v2.8.2-319-g8eb7655
Kovarththanan Rajaratnam
kovarththanan.rajaratnam at gmail.com
Sat Jul 31 01:57:26 EDT 2010
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 8eb76558b952f8b81c143f08ef5845cee19c7682 (commit)
via 6b9b9f44c80af7ba080be4054e462175737f98dc (commit)
via 41dbdb71cda5b3428c36b2ea283db71d1ab26578 (commit)
from 21b9f95093a846f37df9eec39fbc97cd59dc927e (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8eb76558b952f8b81c143f08ef5845cee19c7682
commit 8eb76558b952f8b81c143f08ef5845cee19c7682
Merge: 21b9f95 6b9b9f4
Author: Kovarththanan Rajaratnam <kovarththanan.rajaratnam at gmail.com>
AuthorDate: Sat Jul 31 07:34:58 2010 +0200
Commit: Kovarththanan Rajaratnam <kovarththanan.rajaratnam at gmail.com>
CommitDate: Sat Jul 31 07:34:58 2010 +0200
Merge branch 'findzlib_fix_version' into next
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6b9b9f44c80af7ba080be4054e462175737f98dc
commit 6b9b9f44c80af7ba080be4054e462175737f98dc
Author: Kovarththanan Rajaratnam <kovarththanan.rajaratnam at gmail.com>
AuthorDate: Sat Jul 31 07:24:47 2010 +0200
Commit: Kovarththanan Rajaratnam <kovarththanan.rajaratnam at gmail.com>
CommitDate: Sat Jul 31 07:24:47 2010 +0200
FindZLIB: optimize zlib.h version parsing
Read zlib.h by using file(STRINGS.....REGEX) to limit the amount of text we apply the version regex on. This patch also addresses the fact that the version string may contain a tweak component.
Patch by Simone Rossetto
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 7432257..fa991f1 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -1,12 +1,20 @@
# - Find zlib
-# Find the native ZLIB includes and library
+# Find the native ZLIB includes and library.
+# Once done this will define
#
# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
# ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found.
#
# ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
-# ZLIB_MAJOR_VERSION - the major version of zlib
+# ZLIB_VERSION_MAJOR - The major version of zlib
+# ZLIB_VERSION_MINOR - The minor version of zlib
+# ZLIB_VERSION_PATCH - The patch version of zlib
+# ZLIB_VERSION_TWEAK - The tweak version of zlib
+#
+# The following variable are provided for backward compatibility
+#
+# ZLIB_MAJOR_VERSION - The major version of zlib
# ZLIB_MINOR_VERSION - The minor version of zlib
# ZLIB_PATCH_VERSION - The patch version of zlib
@@ -36,9 +44,19 @@ FIND_LIBRARY(ZLIB_LIBRARY
)
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-IF (ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
- FILE(READ "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H)
- STRING(REGEX REPLACE ".*#define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1.\\2.\\3" ZLIB_VERSION_STRING "${ZLIB_H}")
+IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
+ FILE(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$")
+
+ STRING(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}")
+ STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}")
+ STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}")
+ STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_TWEAK "${ZLIB_H}")
+
+ SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}.${ZLIB_VERSION_TWEAK}")
+
+ SET(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}")
+ SET(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}")
+ SET(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}")
ENDIF()
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
@@ -46,8 +64,22 @@ ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_INCLUDE_DIR ZLIB_LIBRARY)
-IF (ZLIB_FOUND)
+# handle the VERSION provided in find_package() command
+if(ZLIB_FIND_VERSION)
+ if(ZLIB_FIND_VERSION_EXACT AND NOT ${ZLIB_VERSION_STRING} VERSION_EQUAL ${ZLIB_FIND_VERSION})
+ message(FATAL_ERROR "ZLIB version found (${ZLIB_VERSION_STRING}) does not match the required one (${ZLIB_FIND_VERSION}), aborting.")
+ elseif(${ZLIB_VERSION_STRING} VERSION_LESS ${ZLIB_FIND_VERSION})
+ if(ZLIB_FIND_REQUIRED)
+ message(FATAL_ERROR "ZLIB version found (${ZLIB_VERSION_STRING}) is less then the minimum required (${ZLIB_FIND_VERSION}), aborting.")
+ else(ZLIB_FIND_REQUIRED)
+ message("ZLIB version found (${ZLIB_VERSION_STRING}) is less then the minimum required (${ZLIB_FIND_VERSION}), continue without ZLIB support.")
+ set(ZLIB_FOUND FALSE)
+ endif(ZLIB_FIND_REQUIRED)
+ endif()
+endif(ZLIB_FIND_VERSION)
+
+IF(ZLIB_FOUND)
SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
- SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+ SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
ENDIF()
-----------------------------------------------------------------------
Summary of changes:
Modules/FindZLIB.cmake | 46 +++++++++++++++++++++++++++++++-----
Source/kwsys/kwsysDateStamp.cmake | 2 +-
2 files changed, 40 insertions(+), 8 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list