Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -546,32 +546,10 @@ set(USE_ZLIB OFF)
if(WITH_ZLIB)

find_package(ZLIB REQUIRED)

set(USE_ZLIB ON)
add_definitions( -DUSE_ZLIB )
list(APPEND SWIG_EXTRA_ARGS -DUSE_ZLIB)

# make sure that we have a valid zip library
file(TO_CMAKE_PATH "${ZLIB_LIBRARY}" LIBZ_CMAKE_PATH)
check_library_exists("${LIBZ_CMAKE_PATH}" "gzopen" "" LIBZ_CMAKE_PATH)
if(NOT LIBZ_FOUND_SYMBOL)
# this is odd, but on windows this check always fails! must be a
# bug in the current cmake version so for now only issue this
# warning on linux
if(UNIX)
message(WARNING
"The chosen zlib library does not appear to be valid because it is
missing certain required symbols. Please check that ${LIBZ_LIBRARY} is
the correct zlib library. For details about the error, please see
${LIBSBML_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log")
endif()
endif()

if(NOT EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
message(FATAL_ERROR
"The include directory specified for zlib does not appear to be
valid. It should contain the file zlib.h, but it does not.")
endif()

list(APPEND LIBSBML_FIND_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/FindZLIB.cmake")

endif(WITH_ZLIB)
Expand Down
20 changes: 19 additions & 1 deletion CMakeModules/FindZLIB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,25 @@ if (NOT (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) OR NOT ZLIB_FOUND)
set(ZLIB_VERSION ${PC_ZLIB_VERSION} CACHE STRING "Zlib Version found" )
endif (PC_ZLIB_FOUND)
endif (NOT WIN32)


# make sure that we have a valid zip library
file(TO_CMAKE_PATH "${ZLIB_LIBRARY}" LIBZ_CMAKE_PATH)
include (CheckLibraryExists)
check_library_exists("${LIBZ_CMAKE_PATH}" "gzopen" "" LIBZ_CMAKE_PATH)
if(NOT LIBZ_FOUND_SYMBOL)
# this is odd, but on windows this check always fails! must be a
# bug in the current cmake version so for now only issue this
# warning on linux
if(UNIX)
message(WARNING
"The chosen zlib library does not appear to be valid because it is
missing certain required symbols. Please check that ${LIBZ_LIBRARY} is
the correct zlib library. For details about the error, please see
${LIBSBML_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log")
endif()
endif()


mark_as_advanced(ZLIB_INCLUDE_DIR ZLIB_LIBRARY)

endif () # Check for cached values
Expand Down