2011-03-20 23:45:24 +01:00
|
|
|
#based on zlib-1.2.5/CMakeLists.txt
|
|
|
|
#
|
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2016-05-02 16:03:16 +02:00
|
|
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
2011-03-20 23:45:24 +01:00
|
|
|
|
2016-05-02 16:03:16 +02:00
|
|
|
project(zlib C)
|
2011-03-20 23:45:24 +01:00
|
|
|
|
2016-05-02 16:03:16 +02:00
|
|
|
include(CheckTypeSize)
|
|
|
|
include(CheckFunctionExists)
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckCSourceCompiles)
|
2011-03-20 23:45:24 +01:00
|
|
|
|
|
|
|
CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
|
|
|
|
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
|
|
|
|
CHECK_INCLUDE_FILE(stddef.h HAVE_STDDEF_H)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check to see if we have large file support
|
|
|
|
#
|
2016-05-02 16:03:16 +02:00
|
|
|
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
|
2011-03-20 23:45:24 +01:00
|
|
|
# We add these other definitions here because CheckTypeSize.cmake
|
|
|
|
# in CMake 2.4.x does not automatically do so and we want
|
|
|
|
# compatibility with CMake 2.4.x.
|
2016-05-02 16:03:16 +02:00
|
|
|
if(HAVE_SYS_TYPES_H)
|
|
|
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
|
|
|
|
endif()
|
|
|
|
if(HAVE_STDINT_H)
|
|
|
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
|
|
|
|
endif()
|
|
|
|
if(HAVE_STDDEF_H)
|
|
|
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
|
|
|
|
endif()
|
2011-03-20 23:45:24 +01:00
|
|
|
CHECK_TYPE_SIZE(off64_t OFF64_T)
|
2016-05-02 16:03:16 +02:00
|
|
|
if(HAVE_OFF64_T)
|
|
|
|
add_definitions(-D_LARGEFILE64_SOURCE=1)
|
|
|
|
endif()
|
|
|
|
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
|
2011-03-20 23:45:24 +01:00
|
|
|
#
|
|
|
|
# Check for fseeko
|
|
|
|
#
|
|
|
|
CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO)
|
2016-05-02 16:03:16 +02:00
|
|
|
if(NOT HAVE_FSEEKO)
|
|
|
|
add_definitions(-DNO_FSEEKO)
|
|
|
|
endif()
|
2011-03-20 23:45:24 +01:00
|
|
|
#
|
|
|
|
# Check for unistd.h
|
|
|
|
#
|
|
|
|
CHECK_INCLUDE_FILE(unistd.h Z_HAVE_UNISTD_H)
|
|
|
|
|
2016-05-02 16:03:16 +02:00
|
|
|
include_directories(
|
2011-03-20 23:45:24 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${OPENJPEG_SOURCE_DIR}/thirdparty/include
|
|
|
|
)
|
|
|
|
#
|
2016-05-02 16:03:16 +02:00
|
|
|
set(EXT_HDRS
|
2011-03-20 23:45:24 +01:00
|
|
|
${OPENJPEG_SOURCE_DIR}/thirdparty/include/zlib.h
|
|
|
|
${OPENJPEG_SOURCE_DIR}/thirdparty/include/zconf.h
|
|
|
|
)
|
|
|
|
|
2016-05-02 16:03:16 +02:00
|
|
|
set(HDRS
|
2011-03-20 23:45:24 +01:00
|
|
|
crc32.h
|
|
|
|
deflate.h
|
|
|
|
gzguts.h
|
|
|
|
inffast.h
|
|
|
|
inffixed.h
|
|
|
|
inflate.h
|
|
|
|
inftrees.h
|
|
|
|
trees.h
|
|
|
|
zutil.h
|
|
|
|
)
|
2016-05-02 16:03:16 +02:00
|
|
|
set(SRCS
|
2011-03-20 23:45:24 +01:00
|
|
|
adler32.c
|
|
|
|
compress.c
|
|
|
|
crc32.c
|
|
|
|
deflate.c
|
|
|
|
gzclose.c
|
|
|
|
gzlib.c
|
|
|
|
gzread.c
|
|
|
|
gzwrite.c
|
|
|
|
inflate.c
|
|
|
|
infback.c
|
|
|
|
inftrees.c
|
|
|
|
inffast.c
|
|
|
|
trees.c
|
|
|
|
uncompr.c
|
|
|
|
zutil.c
|
|
|
|
)
|
|
|
|
|
2016-05-02 16:03:16 +02:00
|
|
|
set(LIBTARGET "z")
|
2011-03-20 23:45:24 +01:00
|
|
|
#
|
2016-05-02 16:03:16 +02:00
|
|
|
add_library(${LIBTARGET} STATIC ${SRCS} ${EXT_HDRS} ${HDRS})
|
2011-03-20 23:45:24 +01:00
|
|
|
#
|
2016-05-02 16:03:16 +02:00
|
|
|
if(MSVC)
|
|
|
|
set_target_properties(${LIBTARGET} PROPERTIES PREFIX "lib")
|
|
|
|
endif(MSVC)
|
2011-03-20 23:45:24 +01:00
|
|
|
|
2016-05-02 16:03:16 +02:00
|
|
|
set_target_properties(${LIBTARGET}
|
2011-03-20 23:45:24 +01:00
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "${LIBTARGET}"
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib
|
|
|
|
)
|
|
|
|
#
|