Commit 43897ab9 authored by Chris Cantwell's avatar Chris Cantwell

Automatically enable ThirdParty build of Zlib if not found.

Better searching for zlib in macports directory.
Fix to zlib source to work with OSX.
Added check that patch version is 7 or later
(we need 1.2.7, but only check the patch level at the moment)
parent f00eb928
OPTION(THIRDPARTY_BUILD_ZLIB "Build ZLib library" OFF)
########################################################################
#
# ThirdParty configuration for Nektar++
#
# ZLib
#
########################################################################
# Attempt to identify Macports libraries, if they exist. This prevents
# cmake warnings later on.
SET(ZLIB_ROOT /opt/local/lib)
# Find a system ZLIB library
# If not found enable the THIRDPARTY_BUILD_ZLIB option
FIND_PACKAGE( ZLIB )
IF (ZLIB_FOUND AND NOT ZLIB_VERSION_PATCH LESS 7 )
SET(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
SET(ZLIB_LIBRARY_DEBUG ${ZLIB_LIBRARIES})
SET(ZLIB_LIBRARY_RELEASE ${ZLIB_LIBRARIES})
MESSAGE(STATUS "Found Zlib library: ${ZLIB_LIBRARY}")
OPTION(THIRDPARTY_BUILD_ZLIB "Build ZLib library" OFF)
ELSE ()
OPTION(THIRDPARTY_BUILD_ZLIB "Build ZLib library" ON)
ENDIF()
# If we or the user
IF (THIRDPARTY_BUILD_ZLIB)
# Build the Zlib library separately
EXTERNALPROJECT_ADD(
zlib-1.2.7
PREFIX ${TPSRC}
URL ${TPURL}/zlib-1.2.7.tar.gz
URL_MD5 "60df6a37c56e7c1366cca812414f7b85"
URL_MD5 "4a162e0f643232e7e278d59a0603ceb0"
DOWNLOAD_DIR ${TPSRC}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH=${TPSRC}/dist -DCMAKE_C_FLAGS:STRING=-fPIC ${TPSRC}/src/zlib-1.2.7
)
SET(ZLIB_LIBRARY z)
SET(ZLIB_LIBRARY_DEBUG z)
SET(ZLIB_LIBRARY_RELEASE z)
ELSE (THIRDPARTY_BUILD_ZLIB)
# Attempt to identify Macports libraries, if they exist. This prevents
# cmake warnings later on.
IF (APPLE)
FIND_LIBRARY(ZLIB_LIBRARY z PATHS /opt/local/lib NO_DEFAULT_PATH)
ENDIF()
# Find a system ZLIB library and use that instead
IF (ZLIB_LIBRARY-NOTFOUND OR NOT APPLE)
FIND_PACKAGE( ZLIB )
IF (ZLIB_FOUND)
SET(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
ENDIF()
ENDIF()
# IF (ZLIB_LIBRARY)
# SET(Boost_ZLIB_LIBRARY ${ZLIB_LIBRARY})
# SET(Boost_ZLIB_LIBRARY_RELEASE ${ZLIB_LIBRARY})
# SET(Boost_ZLIB_LIBRARY_DEBUG ${ZLIB_LIBRARY})
#ENDIF()
IF (ZLIB_FOUND)
MESSAGE(STATUS "Found Zlib library: ${ZLIB_LIBRARY}")
ENDIF ()
ENDIF (THIRDPARTY_BUILD_ZLIB)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment