@@ -27,9 +27,7 @@ project(
27
27
LANGUAGES C
28
28
)
29
29
30
- include (CheckSymbolExists)
31
30
include (CMakeDependentOption)
32
- include (CMakePushCheckState)
33
31
include (FeatureSummary)
34
32
35
33
option (PHP_EXT_ZIP "Enable the zip extension" )
@@ -111,54 +109,42 @@ endif()
111
109
# TODO: When downloading and building libzip from source additional deps are
112
110
# required.
113
111
114
- if (TARGET libzip::zip)
115
- cmake_push_check_state(RESET)
116
- set (CMAKE_REQUIRED_LIBRARIES libzip::zip)
117
-
118
- check_symbol_exists(zip_file_set_mtime zip.h HAVE_SET_MTIME)
119
-
120
- if (NOT HAVE_SET_MTIME)
121
- message (
122
- WARNING
123
- "ext/zip will not have support for setting mtime "
124
- "(Libzip >= 1.0.0 is needed for setting mtime)"
125
- )
126
- endif ()
127
-
128
- check_symbol_exists(zip_file_set_encryption zip.h HAVE_ENCRYPTION)
129
-
130
- if (NOT HAVE_ENCRYPTION)
131
- message (
132
- WARNING
133
- "ext/zip will not have encryption support "
134
- "(Libzip >= 1.2.0 is needed for encryption support)"
135
- )
136
- endif ()
137
-
138
- check_symbol_exists(
139
- zip_libzip_version
140
- zip.h
141
- HAVE_LIBZIP_VERSION
112
+ if (libzip_FOUND)
113
+ if (libzip_VERSION VERSION_GREATER_EQUAL 1.0.0)
114
+ set (HAVE_SET_MTIME TRUE )
115
+ else ()
116
+ message (
117
+ WARNING
118
+ "ext/zip will not have support for setting mtime "
119
+ "(Libzip >= 1.0.0 is needed for setting mtime)"
142
120
)
121
+ endif ()
143
122
144
- check_symbol_exists(
145
- zip_register_progress_callback_with_state
146
- zip.h
147
- HAVE_PROGRESS_CALLBACK
123
+ if (libzip_VERSION VERSION_GREATER_EQUAL 1.2.0)
124
+ set (HAVE_ENCRYPTION TRUE )
125
+ else ()
126
+ message (
127
+ WARNING
128
+ "ext/zip will not have encryption support "
129
+ "(Libzip >= 1.2.0 is needed for encryption support)"
148
130
)
131
+ endif ()
149
132
150
- check_symbol_exists(
151
- zip_register_cancel_callback_with_state
152
- zip.h
153
- HAVE_CANCEL_CALLBACK
154
- )
133
+ if (libzip_VERSION VERSION_GREATER_EQUAL 1.3.0)
134
+ set (HAVE_PROGRESS_CALLBACK TRUE )
135
+ endif ()
155
136
156
- check_symbol_exists(
157
- zip_compression_method_supported
158
- zip.h
159
- HAVE_METHOD_SUPPORTED
160
- )
161
- cmake_pop_check_state()
137
+ if (libzip_VERSION VERSION_GREATER_EQUAL 1.3.1)
138
+ set (HAVE_LIBZIP_VERSION TRUE )
139
+ endif ()
140
+
141
+ if (libzip_VERSION VERSION_GREATER_EQUAL 1.6.0)
142
+ set (HAVE_CANCEL_CALLBACK TRUE )
143
+ endif ()
144
+
145
+ if (libzip_VERSION VERSION_GREATER_EQUAL 1.7.0)
146
+ set (HAVE_METHOD_SUPPORTED TRUE )
147
+ endif ()
162
148
endif ()
163
149
164
150
set (HAVE_ZIP TRUE )
0 commit comments