summaryrefslogtreecommitdiffstats
path: root/Modules/FindZLIB.cmake
diff options
context:
space:
mode:
authorKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2010-04-11 08:29:20 (GMT)
committerKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2010-04-11 08:55:51 (GMT)
commit79442f8045ffc51c158237c78037bf1e2ac3f667 (patch)
treeb742f3862bca68f60d63f7c7234434390fa04fb5 /Modules/FindZLIB.cmake
parent001efa59610d550b93d8a95324d25ae597febf28 (diff)
downloadCMake-79442f8045ffc51c158237c78037bf1e2ac3f667.zip
CMake-79442f8045ffc51c158237c78037bf1e2ac3f667.tar.gz
CMake-79442f8045ffc51c158237c78037bf1e2ac3f667.tar.bz2
FindZLIB: add support for version handling (fixes #5588)
This change depends on the fix for #9414 which should land very soon.
Diffstat (limited to 'Modules/FindZLIB.cmake')
-rw-r--r--Modules/FindZLIB.cmake16
1 files changed, 13 insertions, 3 deletions
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index f592646..1dac67a 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -1,9 +1,14 @@
# - Find zlib
# Find the native ZLIB includes and library
#
-# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
-# ZLIB_LIBRARIES - List of libraries when using zlib.
-# ZLIB_FOUND - True if zlib found.
+# 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_MINOR_VERSION - The minor version of zlib
+# ZLIB_PATCH_VERSION - The patch version of zlib
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
@@ -31,6 +36,11 @@ FIND_LIBRARY(ZLIB_LIBRARY
)
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
+IF (ZLIB_INCLUDE_DIR)
+ 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}")
+ENDIF()
+
# Per-recommendation
SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}")