1- add_library (php_tsrm OBJECT)
2- add_library (PHP::TSRM ALIAS php_tsrm)
1+ #[=============================================================================[
2+ TSRM (Thread Safe Resource Manager) is a separate directory in php-src as it was
3+ once a standalone project. Ideally, it should be integrated into Zend Engine.
4+
5+ The TSRM::TSRM target is used to transitively pass the TSRM object(s) and
6+ compile options to Zend Engine, which propagates it further as needed.
7+ #]=============================================================================]
8+
9+ add_library (tsrm_object OBJECT)
10+ add_library (tsrm INTERFACE )
11+ add_library (TSRM::TSRM ALIAS tsrm)
12+
13+ target_link_libraries (
14+ tsrm
15+ INTERFACE
16+ tsrm_object
17+ $<TARGET_OBJECTS:tsrm_object>
18+ )
319
420target_sources (
5- php_tsrm
21+ tsrm_object
622 PRIVATE
723 $<$<PLATFORM_ID:Windows>:tsrm_win32.c>
824 TSRM.c
@@ -13,23 +29,25 @@ target_sources(
1329 TSRM.h
1430)
1531
16- target_link_libraries (php_tsrm PRIVATE PHP::configuration )
32+ target_link_libraries (tsrm_object PRIVATE PHP::configuration )
1733
18- target_include_directories (php_tsrm INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} )
34+ target_include_directories (
35+ tsrm_object
36+ INTERFACE
37+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} >
38+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} /${PHP_INCLUDE_PREFIX} /TSRM>
39+ )
1940
2041target_compile_definitions (
21- php_tsrm
42+ tsrm_object
2243 PRIVATE
2344 ZEND_ENABLE_STATIC_TSRMLS_CACHE=1
45+ PUBLIC
2446 $<$<PLATFORM_ID:Windows>:TSRM_EXPORTS>
25- INTERFACE
26- # Pass transitively only to Zend::Zend library on Windows.
27- $<$<AND :$<STREQUAL :$<TARGET_PROPERTY:NAME >,zend>,$<PLATFORM_ID:Windows>>:TSRM_EXPORTS>
2847)
2948
3049install (
31- TARGETS php_tsrm
32- ARCHIVE EXCLUDE_FROM_ALL
50+ TARGETS tsrm_object
3351 FILE_SET HEADERS
3452 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /${PHP_INCLUDE_PREFIX} /TSRM
3553)
0 commit comments