diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a0e4d8..20eaa9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -24,31 +24,19 @@ enable_testing() | |||
24 | # Check to see if we have large file support | 24 | # Check to see if we have large file support |
25 | # | 25 | # |
26 | set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) | 26 | set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) |
27 | |||
28 | check_type_size(off64_t OFF64_T) | 27 | check_type_size(off64_t OFF64_T) |
29 | if(HAVE_OFF64_T) | ||
30 | add_definitions(-D_LARGEFILE64_SOURCE=1) | ||
31 | endif() | ||
32 | set(CMAKE_REQUIRED_DEFINITIONS) # clear variable | 28 | set(CMAKE_REQUIRED_DEFINITIONS) # clear variable |
33 | 29 | ||
34 | # | 30 | # |
35 | # Check for fseeko | 31 | # Check for fseeko |
36 | # | 32 | # |
37 | check_function_exists(fseeko HAVE_FSEEKO) | 33 | check_function_exists(fseeko HAVE_FSEEKO) |
38 | if(NOT HAVE_FSEEKO) | ||
39 | add_definitions(-DNO_FSEEKO) | ||
40 | endif() | ||
41 | 34 | ||
42 | # | 35 | # |
43 | # Check for unistd.h | 36 | # Check for unistd.h |
44 | # | 37 | # |
45 | check_include_file(unistd.h Z_HAVE_UNISTD_H) | 38 | check_include_file(unistd.h Z_HAVE_UNISTD_H) |
46 | 39 | ||
47 | if(MSVC) | ||
48 | add_definitions(-D_CRT_SECURE_NO_DEPRECATE) | ||
49 | add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) | ||
50 | endif() | ||
51 | |||
52 | set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc) | 40 | set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc) |
53 | configure_file( ${zlib_SOURCE_DIR}/zlib.pc.cmakein | 41 | configure_file( ${zlib_SOURCE_DIR}/zlib.pc.cmakein |
54 | ${ZLIB_PC} @ONLY) | 42 | ${ZLIB_PC} @ONLY) |
@@ -130,6 +118,12 @@ if(ZLIB_BUILD_SHARED) | |||
130 | target_include_directories(zlib PUBLIC | 118 | target_include_directories(zlib PUBLIC |
131 | $<BUILD_INTERFACE:${zlib_BINARY_DIR}> | 119 | $<BUILD_INTERFACE:${zlib_BINARY_DIR}> |
132 | $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>) | 120 | $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>) |
121 | target_compile_definitions(zlib | ||
122 | PRIVATE | ||
123 | $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1> | ||
124 | $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> | ||
125 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> | ||
126 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>) | ||
133 | set_target_properties(zlib PROPERTIES | 127 | set_target_properties(zlib PROPERTIES |
134 | DEFINE_SYMBOL ZLIB_DLL | 128 | DEFINE_SYMBOL ZLIB_DLL |
135 | SOVERSION 1 | 129 | SOVERSION 1 |
@@ -147,6 +141,13 @@ if(ZLIB_BUILD_STATIC) | |||
147 | target_include_directories(zlibstatic PUBLIC | 141 | target_include_directories(zlibstatic PUBLIC |
148 | $<BUILD_INTERFACE:${zlib_BINARY_DIR}> | 142 | $<BUILD_INTERFACE:${zlib_BINARY_DIR}> |
149 | $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>) | 143 | $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>) |
144 | target_compile_definitions(zlibstatic | ||
145 | PRIVATE | ||
146 | $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> | ||
147 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> | ||
148 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE> | ||
149 | PUBLIC | ||
150 | $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) | ||
150 | set_target_properties(zlibstatic PROPERTIES | 151 | set_target_properties(zlibstatic PROPERTIES |
151 | PROPERTIES OUTPUT_NAME z${zlib_static_suffix} | 152 | PROPERTIES OUTPUT_NAME z${zlib_static_suffix} |
152 | PROPERTIES OUTPUT_NAME_DEBUG z${zlib_static_suffix}${zlib_debug_suffix}) | 153 | PROPERTIES OUTPUT_NAME_DEBUG z${zlib_static_suffix}${zlib_debug_suffix}) |