1
- cmake_minimum_required (VERSION 2.4.4)
1
+ cmake_minimum_required (VERSION 2.4.4...3.15.0 )
2
2
set (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON )
3
3
4
4
project (zlib C)
5
5
6
- set (VERSION "1.2.13" )
6
+ set (VERSION "1.3.1" )
7
+
8
+ option (ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON )
7
9
8
10
set (INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX} /bin" CACHE PATH "Installation directory for executables" )
9
11
set (INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX} /lib" CACHE PATH "Installation directory for libraries" )
@@ -148,7 +150,9 @@ if(MINGW)
148
150
endif (MINGW)
149
151
150
152
add_library (zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS} )
153
+ target_include_directories (zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
151
154
add_library (zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS} )
155
+ target_include_directories (zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
152
156
set_target_properties (zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
153
157
set_target_properties (zlib PROPERTIES SOVERSION 1)
154
158
@@ -166,7 +170,7 @@ endif()
166
170
if (UNIX )
167
171
# On unix-like platforms the library is almost always called libz
168
172
set_target_properties (zlib zlibstatic PROPERTIES OUTPUT_NAME z)
169
- if (NOT APPLE )
173
+ if (NOT APPLE AND NOT ( CMAKE_SYSTEM_NAME STREQUAL AIX) )
170
174
set_target_properties (zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\" ${CMAKE_CURRENT_SOURCE_DIR} /zlib.map\" " )
171
175
endif ()
172
176
elseif (BUILD_SHARED_LIBS AND WIN32 )
@@ -193,21 +197,22 @@ endif()
193
197
#============================================================================
194
198
# Example binaries
195
199
#============================================================================
196
-
197
- add_executable (example test /example.c)
198
- target_link_libraries (example zlib)
199
- add_test (example example)
200
-
201
- add_executable (minigzip test /minigzip.c)
202
- target_link_libraries (minigzip zlib)
203
-
204
- if (HAVE_OFF64_T)
205
- add_executable (example64 test /example.c)
206
- target_link_libraries (example64 zlib)
207
- set_target_properties (example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64" )
208
- add_test (example64 example64)
209
-
210
- add_executable (minigzip64 test /minigzip.c)
211
- target_link_libraries (minigzip64 zlib)
212
- set_target_properties (minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64" )
200
+ if (ZLIB_BUILD_EXAMPLES)
201
+ add_executable (example test /example.c)
202
+ target_link_libraries (example zlib)
203
+ add_test (example example)
204
+
205
+ add_executable (minigzip test /minigzip.c)
206
+ target_link_libraries (minigzip zlib)
207
+
208
+ if (HAVE_OFF64_T)
209
+ add_executable (example64 test /example.c)
210
+ target_link_libraries (example64 zlib)
211
+ set_target_properties (example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64" )
212
+ add_test (example64 example64)
213
+
214
+ add_executable (minigzip64 test /minigzip.c)
215
+ target_link_libraries (minigzip64 zlib)
216
+ set_target_properties (minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64" )
217
+ endif ()
213
218
endif ()
0 commit comments