@@ -6,7 +6,7 @@ if (${CMAKE_VERSION} VERSION_LESS "3.17.0")
6
6
endif ()
7
7
8
8
project (libzip
9
- VERSION 1.7.3
9
+ VERSION 1.9.2
10
10
LANGUAGES C)
11
11
12
12
option (ENABLE_COMMONCRYPTO "Enable use of CommonCrypto" ON )
@@ -17,6 +17,7 @@ option(ENABLE_WINDOWS_CRYPTO "Enable use of Windows cryptography libraries" ON)
17
17
18
18
option (ENABLE_BZIP2 "Enable use of BZip2" ON )
19
19
option (ENABLE_LZMA "Enable use of LZMA" ON )
20
+ option (ENABLE_ZSTD "Enable use of Zstandard" ON )
20
21
21
22
option (BUILD_TOOLS "Build tools in the src directory (zipcmp, zipmerge, ziptool)" ON )
22
23
option (BUILD_REGRESS "Build regression tests" ON )
@@ -33,33 +34,24 @@ include(CheckCSourceCompiles)
33
34
include (CheckStructHasMember)
34
35
include (TestBigEndian)
35
36
include (GNUInstallDirs)
37
+
36
38
if (ENABLE_COMMONCRYPTO)
37
39
check_include_files(CommonCrypto/CommonCrypto.h COMMONCRYPTO_FOUND)
38
- else ()
39
- set (COMMONCRYPTO_FOUND FALSE )
40
40
endif ()
41
41
if (ENABLE_GNUTLS)
42
42
find_package (Nettle 3.0)
43
43
find_package (GnuTLS)
44
- else ()
45
- set (GNUTLS_FOUND FALSE )
46
44
endif ()
47
45
if (ENABLE_MBEDTLS)
48
46
find_package (MbedTLS 1.0)
49
- else ()
50
- set (MBEDTLS_LIBRARIES FALSE )
51
47
endif ()
52
48
if (ENABLE_OPENSSL)
53
49
find_package (OpenSSL)
54
- else ()
55
- set (OPENSSL_FOUND FALSE )
56
50
endif ()
57
51
if (WIN32 )
58
52
if (ENABLE_WINDOWS_CRYPTO)
59
53
set (WINDOWS_CRYPTO_FOUND TRUE )
60
54
endif ()
61
- else ()
62
- set (WINDOWS_CRYPTO_FOUND FALSE )
63
55
endif ()
64
56
65
57
option (BUILD_SHARED_LIBS "Build shared libraries" ON )
@@ -100,24 +92,25 @@ check_function_exists(_dup HAVE__DUP)
100
92
check_function_exists(_fdopen HAVE__FDOPEN)
101
93
check_function_exists(_fileno HAVE__FILENO)
102
94
check_function_exists(_setmode HAVE__SETMODE)
103
- check_function_exists (_snprintf HAVE__SNPRINTF)
95
+ check_symbol_exists (_snprintf stdio.h HAVE__SNPRINTF)
104
96
check_function_exists(_strdup HAVE__STRDUP)
105
- check_function_exists (_stricmp HAVE__STRICMP)
97
+ check_symbol_exists (_stricmp string .h HAVE__STRICMP)
106
98
check_function_exists(_strtoi64 HAVE__STRTOI64)
107
99
check_function_exists(_strtoui64 HAVE__STRTOUI64)
108
100
check_function_exists(_unlink HAVE__UNLINK)
109
101
check_function_exists(arc4random HAVE_ARC4RANDOM)
110
102
check_function_exists(clonefile HAVE_CLONEFILE)
111
103
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
112
104
check_function_exists(explicit_memset HAVE_EXPLICIT_MEMSET)
105
+ check_function_exists(fchmod HAVE_FCHMOD)
113
106
check_function_exists(fileno HAVE_FILENO)
114
107
check_function_exists(fseeko HAVE_FSEEKO)
115
108
check_function_exists(ftello HAVE_FTELLO)
116
109
check_function_exists(getprogname HAVE_GETPROGNAME)
117
110
check_function_exists(localtime_r HAVE_LOCALTIME_R)
118
111
check_function_exists(setmode HAVE_SETMODE)
119
- check_function_exists (snprintf HAVE_SNPRINTF)
120
- check_function_exists (strcasecmp HAVE_STRCASECMP)
112
+ check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
113
+ check_symbol_exists (strcasecmp strings .h HAVE_STRCASECMP)
121
114
check_function_exists(strdup HAVE_STRDUP)
122
115
check_function_exists(stricmp HAVE_STRICMP)
123
116
check_function_exists(strtoll HAVE_STRTOLL)
@@ -199,10 +192,18 @@ if(ENABLE_LZMA)
199
192
if (LIBLZMA_FOUND)
200
193
set (HAVE_LIBLZMA 1)
201
194
else ()
202
- message (WARNING "-- lzma library not found; lzma support disabled" )
195
+ message (WARNING "-- lzma library not found; lzma/xz support disabled" )
203
196
endif (LIBLZMA_FOUND)
204
197
endif (ENABLE_LZMA)
205
198
199
+ if (ENABLE_ZSTD)
200
+ find_package (Zstd 1.3.6)
201
+ if (Zstd_FOUND)
202
+ set (HAVE_LIBZSTD 1)
203
+ else ()
204
+ message (WARNING "-- zstd library not found; zstandard support disabled" )
205
+ endif (Zstd_FOUND)
206
+ endif (ENABLE_ZSTD)
206
207
207
208
if (COMMONCRYPTO_FOUND)
208
209
set (HAVE_CRYPTO 1)
@@ -221,7 +222,7 @@ elseif (MBEDTLS_FOUND)
221
222
set (HAVE_MBEDTLS 1)
222
223
endif ()
223
224
224
- if (NOT HAVE_CRYPTO)
225
+ if ((ENABLE_COMMONCRYPTO OR ENABLE_GNUTLS OR ENABLE_MBEDTLS OR ENABLE_OPENSSL OR ENABLE_WINDOWS_CRYPTO) AND NOT HAVE_CRYPTO)
225
226
message (WARNING "-- neither Common Crypto, GnuTLS, mbed TLS, OpenSSL, nor Windows Cryptography found; AES support disabled" )
226
227
endif ()
227
228
@@ -266,7 +267,7 @@ endif()
266
267
267
268
include (FindPerl)
268
269
269
- if (NOT PERL_FOUND)
270
+ if (BUILD_REGRESS AND NOT PERL_FOUND)
270
271
message (WARNING "-- perl not found, regression testing disabled" )
271
272
set (BUILD_REGRESS OFF )
272
273
endif ()
@@ -281,11 +282,12 @@ endif()
281
282
282
283
283
284
# pkgconfig file
284
- set (prefix ${CMAKE_INSTALL_PREFIX} )
285
- set (exec_prefix \${prefix} )
286
- SET (bindir \${exec_prefix} /${CMAKE_INSTALL_BINDIR} )
287
- SET (libdir \${exec_prefix} /${CMAKE_INSTALL_LIBDIR} )
288
- SET (includedir \${prefix} /${CMAKE_INSTALL_INCLUDEDIR} )
285
+ file (RELATIVE_PATH pc_relative_bindir ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_BINDIR} )
286
+ set (bindir "\$ {prefix}/${pc_relative_bindir} " )
287
+ file (RELATIVE_PATH pc_relative_libdir ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_LIBDIR} )
288
+ set (libdir "\$ {prefix}/${pc_relative_libdir} " )
289
+ file (RELATIVE_PATH pc_relative_includedir ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_INCLUDEDIR} )
290
+ set (includedir "\$ {prefix}/${pc_relative_includedir} " )
289
291
if (CMAKE_SYSTEM_NAME MATCHES BSD)
290
292
set (PKG_CONFIG_RPATH "-Wl,-R\$ {libdir}" )
291
293
endif (CMAKE_SYSTEM_NAME MATCHES BSD)
@@ -299,6 +301,7 @@ foreach(LIB ${LIBS_PRIVATE})
299
301
endforeach ()
300
302
string (REGEX REPLACE "-lBZip2::BZip2" "-lbz2" LIBS ${LIBS} )
301
303
string (REGEX REPLACE "-lLibLZMA::LibLZMA" "-llzma" LIBS ${LIBS} )
304
+ string (REGEX REPLACE "-lZstd::Zstd" "-lzstd" LIBS ${LIBS} )
302
305
string (REGEX REPLACE "-lOpenSSL::Crypto" "-lssl -lcrypto" LIBS ${LIBS} )
303
306
string (REGEX REPLACE "-lZLIB::ZLIB" "-lz" LIBS ${LIBS} )
304
307
string (REGEX REPLACE "-lGnuTLS::GnuTLS" "-lgnutls" LIBS ${LIBS} )
@@ -429,12 +432,12 @@ write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-v
429
432
configure_package_config_file("${PROJECT_NAME} -config.cmake.in" "${PROJECT_BINARY_DIR} /${PROJECT_NAME} -config.cmake"
430
433
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/libzip)
431
434
432
- # Add targets to the build-tree export set
433
- export (TARGETS zip
434
- FILE "${PROJECT_BINARY_DIR} /${PROJECT_NAME} -targets.cmake" )
435
-
436
- # installation
437
435
if (LIBZIP_DO_INSTALL)
436
+ # Add targets to the build-tree export set
437
+ export (TARGETS zip
438
+ FILE "${PROJECT_BINARY_DIR} /${PROJECT_NAME} -targets.cmake" )
439
+
440
+ # installation
438
441
install (FILES ${PROJECT_BINARY_DIR} /zipconf.h DESTINATION include )
439
442
install (FILES ${PROJECT_BINARY_DIR} /${PROJECT_NAME} -config.cmake ${PROJECT_BINARY_DIR} /${PROJECT_NAME} -config-version .cmake
440
443
DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/${PROJECT_NAME}
@@ -443,4 +446,3 @@ if(LIBZIP_DO_INSTALL)
443
446
DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/${PROJECT_NAME}
444
447
)
445
448
endif ()
446
-
0 commit comments