FindZLIB: make sure zlib.h exists before reading it

This commit is contained in:
Kovarththanan Rajaratnam 2010-05-13 06:34:33 +02:00
parent 6283ce6738
commit 4cde0b1a5f
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ FIND_LIBRARY(ZLIB_LIBRARY
) )
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
IF (ZLIB_INCLUDE_DIR) IF (ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
FILE(READ "${ZLIB_INCLUDE_DIR}/zlib.h" 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() ENDIF()