Skip to content

Commit 5e3f501

Browse files
committed
- make the symbol check optional
1 parent 66ee2bd commit 5e3f501

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

CMakeModules/FindZLIB.cmake

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ if (NOT (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) OR NOT ZLIB_FOUND)
3131
find_path(ZLIB_INCLUDE_DIR zlib.h zlib/zlib.h
3232
PATHS $ENV{ZLIB_DIR}/include
3333
$ENV{ZLIB_DIR}
34-
${${_PROJECT_DEPENDENCY_DIR}}/include
34+
${${_PROJECT_DEPENDENCY_DIR}}/include
3535
~/Library/Frameworks
3636
/Library/Frameworks
3737
/sw/include # Fink
3838
/opt/local/include # MacPorts
3939
/opt/csw/include # Blastwave
4040
/opt/include
4141
/usr/freeware/include
42-
CMAKE_FIND_ROOT_PATH_BOTH
43-
NO_DEFAULT_PATH)
42+
CMAKE_FIND_ROOT_PATH_BOTH
43+
NO_DEFAULT_PATH)
4444

4545
if (NOT ZLIB_INCLUDE_DIR)
4646
find_path(ZLIB_INCLUDE_DIR zlib.h zlib/zlib.h
@@ -84,21 +84,19 @@ if (NOT (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) OR NOT ZLIB_FOUND)
8484

8585

8686
# make sure that we have a valid zip library
87+
if (ZLIB_CHECK_FOR_SYMBOLS)
8788
file(TO_CMAKE_PATH "${ZLIB_LIBRARY}" LIBZ_CMAKE_PATH)
88-
include (CheckLibraryExists)
89+
include(CheckLibraryExists)
8990
check_library_exists("${LIBZ_CMAKE_PATH}" "gzopen" "" LIBZ_FOUND_SYMBOL)
90-
if(NOT LIBZ_FOUND_SYMBOL)
91-
# this is odd, but on windows this check always fails! must be a
92-
# bug in the current cmake version so for now only issue this
93-
# warning on linux
94-
if(UNIX)
95-
message(WARNING
96-
"The chosen zlib library does not appear to be valid because it is
97-
missing certain required symbols. Please check that ${LIBZ_LIBRARY} is
98-
the correct zlib library. For details about the error, please see
99-
CMakeError.log or CMakeConfigureLog.yaml in the build directory.")
100-
endif()
91+
92+
if(NOT LIBZ_FOUND_SYMBOL AND UNIX)
93+
message(WARNING
94+
"The chosen zlib library does not appear to be valid because it is
95+
missing certain required symbols. Please check that ${ZLIB_LIBRARY} is
96+
the correct zlib library. For details about the error, please see
97+
CMakeError.log or CMakeConfigureLog.yaml in the build directory.")
10198
endif()
99+
endif() # Check for symbols
102100

103101
mark_as_advanced(ZLIB_INCLUDE_DIR ZLIB_LIBRARY)
104102

0 commit comments

Comments
 (0)