ThirdPartyZlib.cmake 1.36 KB
Newer Older
1 2 3 4 5 6 7
########################################################################
#
# ThirdParty configuration for Nektar++
#
# ZLib
#
########################################################################
8

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
# 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
29
IF (THIRDPARTY_BUILD_ZLIB)
30
    MESSAGE(STATUS "Will build Zlib 1.2.7")
31 32
    # Build the Zlib library separately
    EXTERNALPROJECT_ADD(
33
        zlib-1.2.7
34
        PREFIX ${TPSRC}
35
        URL ${TPURL}/zlib-1.2.7.tar.gz
36
        URL_MD5 "4a162e0f643232e7e278d59a0603ceb0"
37
        DOWNLOAD_DIR ${TPSRC}
38
        CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH=${TPSRC}/dist -DCMAKE_C_FLAGS:STRING=-fPIC ${TPSRC}/src/zlib-1.2.7
39
    )
40 41 42
    SET(ZLIB_LIBRARY z)
    SET(ZLIB_LIBRARY_DEBUG z)
    SET(ZLIB_LIBRARY_RELEASE z)
43 44
ENDIF (THIRDPARTY_BUILD_ZLIB)