FindZLIB: make sure zlib.h exists before reading it
This commit is contained in:
parent
6283ce6738
commit
4cde0b1a5f
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue