diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2010-06-22 15:17:44 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2010-06-24 16:52:37 (GMT) |
commit | 5850b8b79a813dbe8ad380c88878260cae3d7cbc (patch) | |
tree | 4312198e30e8b84c2a521c7be2cf5fedc310c1af /Modules/FindZLIB.cmake | |
parent | ec10d005ce038281e634357697dcf223674fae77 (diff) | |
download | CMake-5850b8b79a813dbe8ad380c88878260cae3d7cbc.zip CMake-5850b8b79a813dbe8ad380c88878260cae3d7cbc.tar.gz CMake-5850b8b79a813dbe8ad380c88878260cae3d7cbc.tar.bz2 |
Fix performance issue with getting version from zlib.h
Some zlib.h files have ZLIB_VERSION "1.2.3.3" with 4 numbers instead of 3.
The regex is changed to grab the first 3 numbers.
It was slow because if it failed to find that string near the top of the file,
where it usually is, it would read the entire file.
Diffstat (limited to 'Modules/FindZLIB.cmake')
-rw-r--r-- | Modules/FindZLIB.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index b437e6b..7432257 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -38,7 +38,7 @@ 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}") + STRING(REGEX REPLACE ".*#define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1.\\2.\\3" ZLIB_VERSION_STRING "${ZLIB_H}") ENDIF() # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if |