diff options
author | Alex Neundorf <neundorf@kde.org> | 2010-08-14 20:16:06 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2010-08-14 20:16:06 (GMT) |
commit | 75e727855ae860d4289c9dafa8247a4cb3b5852f (patch) | |
tree | 21400d6e3e8c9ab8ba5a8294455a16c9395132f4 /Modules/FindZLIB.cmake | |
parent | 16168ab0c3549b6953fe95354446508ce3cc945e (diff) | |
download | CMake-75e727855ae860d4289c9dafa8247a4cb3b5852f.zip CMake-75e727855ae860d4289c9dafa8247a4cb3b5852f.tar.gz CMake-75e727855ae860d4289c9dafa8247a4cb3b5852f.tar.bz2 |
Fix ZLIB version parsing if no TWEAK version exists
ZLIB_VERSION_STRING was "1.2.3.#define ZLIB_VERSION "1.2.3"" here, because
the result of the matching for the tweak version was also appended if there
was no TWEAK version and the regexp failed, which gives as result not
an empty string, but the full string.
Now it is only appended if the regexp matches.
Alex
Diffstat (limited to 'Modules/FindZLIB.cmake')
-rw-r--r-- | Modules/FindZLIB.cmake | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index ce29ca0..1ac6c2c 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -50,9 +50,14 @@ IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") 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}") - SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}.${ZLIB_VERSION_TWEAK}") + # only append a TWEAK version if it exists: + SET(ZLIB_VERSION_TWEAK "") + IF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") + SET(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") + SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") + ENDIF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") SET(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") SET(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") |