Skip to content

Commit 4539c23

Browse files
committed
Fix nits in ext/pcre
- Synced cache variables naming conventions - Fixed adding .def file directly to the interface php_sapi target (this seems to be the simplest possible solution in this case).
1 parent a4f5e15 commit 4539c23

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

cmake/cmake/toolchains/template.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ set(HAVE_SHM_MMAP_POSIX_EXITCODE 0)
124124
# ext/pcre
125125
################################################################################
126126

127-
# Set the exit code for the check whether the bundled PCRE library has JIT
128-
# supported on the target architecture.
129-
set(HAVE_PCRE_JIT_SUPPORT_EXITCODE 0)
127+
# Set the exit code of the check when using an external PCRE library whether JIT
128+
# support is available for the target architecture.
129+
set(PHP_EXT_PCRE_HAS_JIT_EXITCODE 0)
130130

131131
################################################################################
132132
# ext/posix

cmake/ext/pcre/CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,13 @@ target_sources(
7070
php_ext_pcre
7171
PRIVATE
7272
php_pcre.c
73-
php_pcre.def
7473
php_pcre.stub.php
7574
PUBLIC
7675
FILE_SET HEADERS
7776
FILES
7877
php_pcre.h
7978
)
8079

81-
# TODO: Fix this better for OBJECT libraries, which can't handle .def files.
82-
set_source_files_properties(php_pcre.def PROPERTIES HEADER_FILE_ONLY TRUE)
83-
8480
target_compile_definitions(php_ext_pcre PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE)
8581

8682
set(PCRE2_CODE_UNIT_WIDTH 8)
@@ -100,13 +96,13 @@ if(PHP_EXT_PCRE_EXTERNAL)
10096
message(CHECK_START "Checking for PCRE JIT support")
10197

10298
if(
103-
NOT DEFINED HAVE_PCRE_JIT_SUPPORT_EXITCODE
99+
NOT DEFINED PHP_EXT_PCRE_HAS_JIT_EXITCODE
104100
AND CMAKE_CROSSCOMPILING
105101
AND NOT CMAKE_CROSSCOMPILING_EMULATOR
106102
AND CMAKE_SYSTEM_PROCESSOR MATCHES
107103
"^(arm.*|i[34567]86|x86_64|amd64|mips.*|powerpc.*|sparc.*|X86|AMD64|ARM64)$"
108104
)
109-
set(HAVE_PCRE_JIT_SUPPORT_EXITCODE 0)
105+
set(PHP_EXT_PCRE_HAS_JIT_EXITCODE 0)
110106
endif()
111107

112108
cmake_push_check_state(RESET)
@@ -129,10 +125,11 @@ if(PHP_EXT_PCRE_EXTERNAL)
129125

130126
return !have_jit;
131127
}
132-
]] HAVE_PCRE_JIT_SUPPORT)
128+
]] PHP_EXT_PCRE_HAS_JIT)
133129
cmake_pop_check_state()
134130

135-
if(HAVE_PCRE_JIT_SUPPORT)
131+
if(PHP_EXT_PCRE_HAS_JIT)
132+
set(HAVE_PCRE_JIT_SUPPORT TRUE)
136133
message(CHECK_PASS "yes")
137134
else()
138135
message(CHECK_FAIL "no")
@@ -205,6 +202,10 @@ else()
205202

206203
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
207204
set(PCRE2_STATIC TRUE)
205+
206+
if(TARGET php_sapi)
207+
target_sources(php_sapi INTERFACE php_pcre.def)
208+
endif()
208209
endif()
209210

210211
target_compile_definitions(

0 commit comments

Comments
 (0)