forked from commontk/zlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
97 lines (80 loc) · 2.66 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
cmake_minimum_required(VERSION 2.8)
PROJECT(ZLIB)
SET(ZLIB_MANGLE_PREFIX "" CACHE STRING "Mangle prefix. For example 'cm_zlib_', 'z_', ...")
SET(ZLIB_VERSION_MAJOR "1")
SET(ZLIB_VERSION_MINOR "2")
SET(ZLIB_VERSION_PATCH "3")
INCLUDE_DIRECTORIES(
"${ZLIB_SOURCE_DIR}"
"${ZLIB_SOURCE_DIR}"
"${ZLIB_BINARY_DIR}"
)
# source files for zlib
SET(ZLIB_SRCS
adler32.c compress.c crc32.c deflate.c gzio.c inffast.c
inflate.c inftrees.c trees.c uncompr.c zutil.c
)
# for windows add the .def and .rc files to the source list
# if building shared libs
IF(WIN32)
IF(BUILD_SHARED_LIBS)
SET(ZLIB_DLL 1)
IF(NOT UNIX)
IF(NOT BORLAND)
IF(NOT MINGW)
CONFIGURE_FILE(zlib.def.in ${ZLIB_BINARY_DIR}/zlib.def)
SET(ZLIB_SRCS ${ZLIB_SRCS} ${ZLIB_BINARY_DIR}/zlib.def zlib.rc)
ENDIF(NOT MINGW)
ENDIF(NOT BORLAND)
ENDIF(NOT UNIX)
ENDIF(BUILD_SHARED_LIBS)
ENDIF(WIN32)
CONFIGURE_FILE(${ZLIB_SOURCE_DIR}/.NoDartCoverage
${ZLIB_BINARY_DIR}/.NoDartCoverage)
CONFIGURE_FILE(${ZLIB_SOURCE_DIR}/zlibDllConfig.h.in
${ZLIB_BINARY_DIR}/zlibDllConfig.h)
CONFIGURE_FILE(${ZLIB_SOURCE_DIR}/zlib_mangle.h.in
${ZLIB_BINARY_DIR}/zlib_mangle.h)
FOREACH(name zlib zconf)
CONFIGURE_FILE(${ZLIB_SOURCE_DIR}/${name}.h
${ZLIB_BINARY_DIR}/${name}.h COPYONLY)
ENDFOREACH(name)
ADD_LIBRARY(zlib ${ZLIB_SRCS})
# To fix compilation problem: relocation R_X86_64_32 against `a local symbol' can not be
# used when making a shared object; recompile with -fPIC
# See http://www.cmake.org/pipermail/cmake/2007-May/014350.html
#
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
SET_TARGET_PROPERTIES(zlib PROPERTIES COMPILE_FLAGS "-fPIC")
ENDIF()
# Configure install locations. This allows parent projects to modify
# the install location.
IF(NOT ZLIB_INSTALL_BIN_DIR)
SET(ZLIB_INSTALL_BIN_DIR bin)
ENDIF()
IF(NOT ZLIB_INSTALL_INCLUDE_DIR)
SET(ZLIB_INSTALL_INCLUDE_DIR include)
ENDIF()
IF(NOT ZLIB_INSTALL_LIB_DIR)
SET(ZLIB_INSTALL_LIB_DIR lib)
ENDIF()
IF(NOT ZLIB_INSTALL_DOC_DIR)
SET(ZLIB_INSTALL_DOC_DIR
doc/zlib-${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}
)
ENDIF()
# Install library
INSTALL(TARGETS zlib
RUNTIME DESTINATION ${ZLIB_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${ZLIB_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${ZLIB_INSTALL_LIB_DIR} COMPONENT Development
)
# Install public headers
INSTALL(FILES
zlib.h
zconf.h
${ZLIB_BINARY_DIR}/zlib_mangle.h
${ZLIB_BINARY_DIR}/zlibDllConfig.h
DESTINATION ${ZLIB_INSTALL_INCLUDE_DIR} COMPONENT Development
)
INSTALL(FILES Copyright.txt DESTINATION ${ZLIB_INSTALL_DOC_DIR} COMPONENT RuntimeLibraries)