diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:26:58 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:26:58 -0700 |
commit | dc5a43ebfadb6b775f6e64bfeb5a461c66acb394 (patch) | |
tree | 00e122ba59ad883db198dc6adf24d020cac924d3 /CMakeLists.txt | |
parent | d004b047838a7e803818b4973a2e39e0ff8c1fa2 (diff) | |
download | zlib-1.2.3.6.tar.gz zlib-1.2.3.6.tar.bz2 zlib-1.2.3.6.zip |
zlib 1.2.3.6v1.2.3.6
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 19deaa5..5ce81be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -21,7 +21,6 @@ check_include_file(stddef.h HAVE_STDDEF_H) | |||
21 | # Check to see if we have large file support | 21 | # Check to see if we have large file support |
22 | # | 22 | # |
23 | set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE) | 23 | set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE) |
24 | |||
25 | # We add these other definitions here because CheckTypeSize.cmake | 24 | # We add these other definitions here because CheckTypeSize.cmake |
26 | # in CMake 2.4.x does not automatically do so and we want | 25 | # in CMake 2.4.x does not automatically do so and we want |
27 | # compatibility with CMake 2.4.x. | 26 | # compatibility with CMake 2.4.x. |
@@ -34,9 +33,7 @@ endif() | |||
34 | if(HAVE_STDDEF_H) | 33 | if(HAVE_STDDEF_H) |
35 | list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) | 34 | list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) |
36 | endif() | 35 | endif() |
37 | |||
38 | check_type_size(off64_t OFF64_T) | 36 | check_type_size(off64_t OFF64_T) |
39 | |||
40 | if(HAVE_OFF64_T) | 37 | if(HAVE_OFF64_T) |
41 | add_definitions(-D_LARGEFILE64_SOURCE) | 38 | add_definitions(-D_LARGEFILE64_SOURCE) |
42 | endif() | 39 | endif() |
@@ -63,23 +60,6 @@ if(NOT HAVE_ERRNO_H) | |||
63 | endif() | 60 | endif() |
64 | 61 | ||
65 | # | 62 | # |
66 | # Check for mmap support | ||
67 | # | ||
68 | set(mmap_test_code " | ||
69 | #include <sys/types.h> | ||
70 | #include <sys/mman.h> | ||
71 | #include <sys/stat.h> | ||
72 | caddr_t hello() { | ||
73 | return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0); | ||
74 | } | ||
75 | int main() { return 0; } | ||
76 | ") | ||
77 | check_c_source_compiles("${mmap_test_code}" USE_MMAP) | ||
78 | if(USE_MMAP) | ||
79 | add_definitions(-DUSE_MMAP) | ||
80 | endif() | ||
81 | |||
82 | # | ||
83 | # Create the zlibdefs.h file. | 63 | # Create the zlibdefs.h file. |
84 | # Note: we create it in CMAKE_CURRENT_SOURCE_DIR instead | 64 | # Note: we create it in CMAKE_CURRENT_SOURCE_DIR instead |
85 | # of CMAKE_CURRENT_BINARY_DIR because an empty zlibdefs.h | 65 | # of CMAKE_CURRENT_BINARY_DIR because an empty zlibdefs.h |
@@ -88,7 +68,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlibdefs.h.cmakein | |||
88 | ${CMAKE_CURRENT_SOURCE_DIR}/zlibdefs.h) | 68 | ${CMAKE_CURRENT_SOURCE_DIR}/zlibdefs.h) |
89 | 69 | ||
90 | if(MSVC) | 70 | if(MSVC) |
91 | set(CMAKE_DEBUG_POSTFIX "D") | 71 | set(CMAKE_DEBUG_POSTFIX "d") |
92 | add_definitions(-D_CRT_SECURE_NO_DEPRECATE) | 72 | add_definitions(-D_CRT_SECURE_NO_DEPRECATE) |
93 | add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) | 73 | add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) |
94 | endif() | 74 | endif() |
@@ -130,15 +110,47 @@ set(ZLIB_SRCS | |||
130 | trees.c | 110 | trees.c |
131 | uncompr.c | 111 | uncompr.c |
132 | zutil.c | 112 | zutil.c |
113 | win32/zlib1.rc | ||
133 | ) | 114 | ) |
134 | 115 | ||
116 | # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION | ||
117 | file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) | ||
118 | string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9A-Za-z.]+)\".*" | ||
119 | "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) | ||
120 | |||
121 | if(MINGW) | ||
122 | # This gets us DLL resource information when compiling on MinGW. | ||
123 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj | ||
124 | COMMAND windres.exe | ||
125 | -D GCC_WINDRES | ||
126 | -I ${CMAKE_CURRENT_SOURCE_DIR} | ||
127 | -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj | ||
128 | -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) | ||
129 | set(ZLIB_SRCS ${ZLIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) | ||
130 | endif(MINGW) | ||
131 | |||
135 | add_library(zlib ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) | 132 | add_library(zlib ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) |
136 | set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) | 133 | set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) |
137 | set_target_properties(zlib PROPERTIES VERSION 1.2.3.4) | 134 | |
138 | set_target_properties(zlib PROPERTIES SOVERSION 1) | 135 | set_target_properties(zlib PROPERTIES SOVERSION 1) |
136 | |||
137 | if(NOT CYGWIN) | ||
138 | # This property causes shared libraries on Linux to have the full version | ||
139 | # encoded into their final filename. We disable this on Cygwin because | ||
140 | # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll | ||
141 | # seems to be the default. | ||
142 | # | ||
143 | # This has no effect with MSVC, on that platform the version info for | ||
144 | # the DLL comes from the resource file win32/zlib1.rc | ||
145 | set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) | ||
146 | endif() | ||
147 | |||
139 | if(UNIX) | 148 | if(UNIX) |
140 | # On unix like platforms the library is almost always called libz | 149 | # On unix-like platforms the library is almost always called libz |
141 | set_target_properties(zlib PROPERTIES OUTPUT_NAME z) | 150 | set_target_properties(zlib PROPERTIES OUTPUT_NAME z) |
151 | elseif(BUILD_SHARED_LIBS AND WIN32) | ||
152 | # Creates zlib1.dll when building shared library version | ||
153 | set_target_properties(zlib PROPERTIES SUFFIX "1.dll") | ||
142 | endif() | 154 | endif() |
143 | 155 | ||
144 | if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) | 156 | if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) |