-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
82 lines (61 loc) · 1.52 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#[=============================================================================[
# The zlib extension
Configure the `zlib` extension.
This extension provides support for reading and writing gzip (.gz) compressed
files.
## EXT_ZLIB
* Default: `OFF`
* Values: `ON|OFF`
Enable the extension.
## EXT_ZLIB_SHARED
* Default: `OFF`
* Values: `ON|OFF`
Build extension as shared.
#]=============================================================================]
project(
PhpExtensionZlib
LANGUAGES C
)
include(CMakeDependentOption)
include(FeatureSummary)
option(EXT_ZLIB "Enable the zlib extension" OFF)
add_feature_info(
"ext/zlib"
EXT_ZLIB
"Support for reading and writing gzip (.gz) compressed files"
)
cmake_dependent_option(
EXT_ZLIB_SHARED
"Build the zlib extension as a shared library"
OFF
"EXT_ZLIB;NOT BUILD_SHARED_LIBS"
OFF
)
if(NOT EXT_ZLIB)
return()
endif()
if(EXT_ZLIB_SHARED)
add_library(php_zlib SHARED)
else()
add_library(php_zlib)
endif()
target_sources(
php_zlib
PRIVATE
$<$<AND:$<PLATFORM_ID:Windows>,$<NOT:$<IN_LIST:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY;SHARED_LIBRARY>>>:php_zlib.def>
zlib_filter.c
zlib_fopen_wrapper.c
zlib.c
zlib.stub.php
)
target_compile_definitions(php_zlib PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
include(Packages/ZLIB)
set_package_properties(
ZLIB
PROPERTIES
TYPE REQUIRED
PURPOSE "Necessary to enable the zlib extension."
)
target_link_libraries(php_zlib PUBLIC ZLIB::ZLIB)
set(HAVE_ZLIB 1)
configure_file(config.cmake.h.in config.h)