diff --git a/cmake/Zend/CMakeLists.txt b/cmake/Zend/CMakeLists.txt index e98a14ff8..41b60efc5 100644 --- a/cmake/Zend/CMakeLists.txt +++ b/cmake/Zend/CMakeLists.txt @@ -298,8 +298,8 @@ target_link_libraries(zend PRIVATE PHP::configuration) target_include_directories( zend INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} ) target_compile_definitions( @@ -318,23 +318,35 @@ set_target_properties( ZEND_MODULE_API_NO ${Zend_VERSION_MODULE_API_NO} ) -# Add Zend PUBLIC/INTERFACE compile properties to configuration. +################################################################################ +# Add usage requirements to PHP interface targets. +################################################################################ + # Cleaner COMPILE_ONLY generator expression is available in CMake >= 3.27. if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.27) - target_link_libraries(php_configuration INTERFACE $) + target_link_libraries(php_configuration INTERFACE $) else() - target_include_directories( + target_compile_definitions( php_configuration INTERFACE - $ + $ ) - target_compile_definitions( + target_compile_options( + php_configuration + INTERFACE + $ + ) + target_include_directories( php_configuration INTERFACE - $ + $ + $ ) endif() +target_link_libraries(php_sapi INTERFACE Zend::Zend) +target_sources(php_sapi INTERFACE $) + ################################################################################ # TSRM (Thread Safe Resource Manager) is a separate directory in php-src as it # was once a standalone project. Ideally, it should be moved into Zend Engine at diff --git a/cmake/Zend/cmake/MaxExecutionTimers.cmake b/cmake/Zend/cmake/MaxExecutionTimers.cmake index 86a1e8576..b540ddd96 100644 --- a/cmake/Zend/cmake/MaxExecutionTimers.cmake +++ b/cmake/Zend/cmake/MaxExecutionTimers.cmake @@ -86,13 +86,6 @@ add_feature_info( "enhanced timeout and signal handling" ) -# Set the result variable also in the PARENT_SCOPE, to make it available for the -# parent project PHP in its configuration headers. This module is included in -# the Zend Engine which is added with add_subdirectory() in the PHP project. -if(NOT PROJECT_IS_TOP_LEVEL) - set(ZEND_MAX_EXECUTION_TIMERS ${ZEND_MAX_EXECUTION_TIMERS} PARENT_SCOPE) -endif() - add_library(Zend::MaxExecutionTimers INTERFACE IMPORTED GLOBAL) if(libraryForTimerCreate) target_link_libraries( diff --git a/cmake/cmake/Bootstrap.cmake b/cmake/cmake/Bootstrap.cmake index 6558f79f5..c23ba94e5 100644 --- a/cmake/cmake/Bootstrap.cmake +++ b/cmake/cmake/Bootstrap.cmake @@ -33,7 +33,7 @@ include(PHP/InterproceduralOptimization) # Set CMAKE_POSITION_INDEPENDENT_CODE. include(PHP/PositionIndependentCode) -# Create a project wide INTERFACE library with project configuration. +# INTERFACE library with usage requirements. add_library(php_configuration INTERFACE) add_library(PHP::configuration ALIAS php_configuration) target_include_directories( @@ -43,6 +43,11 @@ target_include_directories( ${PHP_SOURCE_DIR} ) +# INTERFACE library that ties objects and configuration together for PHP SAPIs. +add_library(php_sapi INTERFACE) +add_library(PHP::SAPI ALIAS php_sapi) +target_link_libraries(php_sapi INTERFACE PHP::configuration) + # Create a custom target for generating files (parsers, lexers, etc.) manually: # cmake --build -t php_generate_files add_custom_target(php_generate_files) diff --git a/cmake/cmake/ConfigureChecks.cmake b/cmake/cmake/ConfigureChecks.cmake index f0c1f7d1b..04a1e455f 100644 --- a/cmake/cmake/ConfigureChecks.cmake +++ b/cmake/cmake/ConfigureChecks.cmake @@ -818,7 +818,7 @@ if(PHP_GCOV) endif() endif() -# Check Valgrind. +# Valgrind. if(PHP_VALGRIND) find_package(Valgrind) set_package_properties( @@ -836,6 +836,82 @@ if(PHP_VALGRIND) endif() add_feature_info( "Valgrind" - PHP_VALGRIND + HAVE_VALGRIND "dynamic analysis" ) + +# DTrace. +if(PHP_DTRACE) + message(CHECK_START "Checking for DTrace support") + + find_package(DTrace) + set_package_properties( + DTrace + PROPERTIES + TYPE REQUIRED + PURPOSE "Necessary to enable the DTrace support." + ) + + if(DTrace_FOUND) + dtrace_target( + php_dtrace + INPUT ${PHP_SOURCE_DIR}/Zend/zend_dtrace.d + HEADER ${PHP_BINARY_DIR}/Zend/zend_dtrace_gen.h + SOURCES + ${PHP_SOURCE_DIR}/main/main.c + ${PHP_SOURCE_DIR}/Zend/zend_API.c + ${PHP_SOURCE_DIR}/Zend/zend_dtrace.c + ${PHP_SOURCE_DIR}/Zend/zend_exceptions.c + ${PHP_SOURCE_DIR}/Zend/zend_execute.c + ${PHP_SOURCE_DIR}/Zend/zend.c + INCLUDES + $ + ) + target_link_libraries(php_configuration INTERFACE DTrace::DTrace) + target_link_libraries(php_sapi INTERFACE php_dtrace) + + set(HAVE_DTRACE TRUE) + + message(CHECK_PASS "yes") + else() + message(CHECK_FAIL "no") + endif() +endif() +add_feature_info( + "DTrace" + HAVE_DTRACE + "performance analysis and troubleshooting" +) + +# Dmalloc. +if(PHP_DMALLOC) + message(CHECK_START "Checking for Dmalloc support") + + find_package(Dmalloc) + set_package_properties( + Dmalloc + PROPERTIES + TYPE REQUIRED + PURPOSE "Necessary to use Dmalloc memory debugger." + ) + + target_compile_definitions( + php_configuration + INTERFACE + $<$:DMALLOC_FUNC_CHECK> + ) + + target_link_libraries(php_configuration INTERFACE Dmalloc::Dmalloc) + + if(Dmalloc_FOUND) + message(CHECK_PASS "yes") + set(HAVE_DMALLOC TRUE) + else() + message(CHECK_FAIL "no") + endif() +endif() +add_feature_info( + "Dmalloc" + HAVE_DMALLOC + "memory debugging" +) diff --git a/cmake/cmake/modules/FindGcov.cmake b/cmake/cmake/modules/FindGcov.cmake index 54a1d2fde..8cd810e88 100644 --- a/cmake/cmake/modules/FindGcov.cmake +++ b/cmake/cmake/modules/FindGcov.cmake @@ -188,27 +188,29 @@ macro(gcov_generate_report) ) # Create a list of PHP SAPIs with genex for usage in the add_custom_command. - block(PROPAGATE php_sapis) - set(php_sapis "") + block(PROPAGATE sapis) + set(sapis "") file(GLOB directories ${PROJECT_SOURCE_DIR}/sapi/*) foreach(dir ${directories}) cmake_path(GET dir FILENAME sapi) - list(APPEND php_sapis "$") + list(APPEND sapis "$") endforeach() endblock() add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/php_lcov.info COMMAND ${CMAKE_COMMAND} -P "CMakeFiles/GenerateGcovReport.cmake" - DEPENDS - ${php_sapis} + DEPENDS ${sapis} COMMENT "[GCOV] Generating GCOV coverage report" + VERBATIM + COMMAND_EXPAND_LISTS ) - unset(php_sapis) + unset(sapis) # Create target which consumes the command via DEPENDS. - add_custom_target(gcov ALL + add_custom_target( + gcov ALL DEPENDS ${PROJECT_BINARY_DIR}/php_lcov.info COMMENT "[GCOV] Generating GCOV files" ) diff --git a/cmake/cmake/modules/PHP/Extensions.cmake b/cmake/cmake/modules/PHP/Extensions.cmake index 97ec16a85..9056d273a 100644 --- a/cmake/cmake/modules/PHP/Extensions.cmake +++ b/cmake/cmake/modules/PHP/Extensions.cmake @@ -396,13 +396,17 @@ function(php_extensions_postconfigure extension) "'ON'." ) - set( - EXT_${dependencyUpper} - ON - CACHE BOOL - "Enable the ${dependency} extension" - FORCE - ) + if(DEFINED CACHE{EXT_${dependencyUpper}}) + set_property(CACHE EXT_${dependencyUpper} PROPERTY VALUE ON) + else() + set( + EXT_${dependencyUpper} + ON + CACHE BOOL + "Enable the ${dependency} extension" + FORCE + ) + endif() endforeach() if(NOT TARGET PHP::${extension}) diff --git a/cmake/ext/CMakeLists.txt b/cmake/ext/CMakeLists.txt index 136617379..d4bc512f2 100644 --- a/cmake/ext/CMakeLists.txt +++ b/cmake/ext/CMakeLists.txt @@ -1,10 +1,5 @@ #[=============================================================================[ Add subdirectories of PHP extensions. - -## INTERFACE target - -* `php_extensions` (alias `PHP::extensions`) is an INTERFACE library with all - enabled extensions linked into for convenience. #]=============================================================================] include(PHP/Extensions) @@ -57,9 +52,6 @@ set_property(GLOBAL PROPERTY PHP_ALL_EXTENSIONS ${extensions}) # Sort and preconfigure extensions by their dependencies. php_extensions_preprocess(extensions) -add_library(php_extensions INTERFACE) -add_library(PHP::extensions ALIAS php_extensions) - # Add subdirectories of extensions. foreach(extension IN LISTS extensions) list(APPEND CMAKE_MESSAGE_CONTEXT "${extension}") @@ -80,9 +72,7 @@ foreach(extension IN LISTS extensions) add_dependencies(php_${extension} Zend::Zend) - # Add extension's transitive compile and link properties to configuration. - # The INTERFACE_SOURCES are propagated separately only to PHP::PHP. - # See: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html + # Add usage requirements to PHP interface targets. # TODO: Should PHP_CLI extensions pass properties only to PHP_CLI SAPIs? get_target_property(type php_${extension} TYPE) if(NOT type MATCHES "^(MODULE|SHARED)_LIBRARY$") @@ -112,17 +102,15 @@ foreach(extension IN LISTS extensions) ) target_link_libraries( - php_extensions + php_sapi INTERFACE - $>>,$<$>:$>,$> + $>>,$<$>:PHP::${extension}>,PHP::${extension}> ) target_sources( - php_extensions + php_sapi INTERFACE $>>,$<$>:$>,$> - - $>>,$<$>:$>,$> ) endif() diff --git a/cmake/ext/skeleton/cmake/modules/FindPHP.cmake b/cmake/ext/skeleton/cmake/modules/FindPHP.cmake index 685eedb19..b22206dcf 100644 --- a/cmake/ext/skeleton/cmake/modules/FindPHP.cmake +++ b/cmake/ext/skeleton/cmake/modules/FindPHP.cmake @@ -13,7 +13,7 @@ Components: Module defines the following `IMPORTED` target(s): * `PHP::php` - The PHP package `IMPORTED` target, if found. -* `PHP:embed` - The PHP embed SAPI, if found. +* `PHP::embed` - The PHP embed SAPI, if found. ## Result variables diff --git a/cmake/ext/standard/CMakeLists.txt b/cmake/ext/standard/CMakeLists.txt index 6b6e7b4ba..378440009 100644 --- a/cmake/ext/standard/CMakeLists.txt +++ b/cmake/ext/standard/CMakeLists.txt @@ -534,42 +534,26 @@ endblock() check_symbol_exists(chroot "unistd.h" HAVE_CHROOT) -add_library(php_standard_functions_cli OBJECT) add_library(php_standard_functions OBJECT) +add_library(php_standard_functions_cli OBJECT) -target_sources(php_standard_functions_cli PRIVATE basic_functions.c dir.c) target_sources(php_standard_functions PRIVATE basic_functions.c dir.c) +target_sources(php_standard_functions_cli PRIVATE basic_functions.c dir.c) -target_include_directories( - php_standard_functions_cli - PRIVATE - $ -) -target_include_directories( +set_target_properties( php_standard_functions - PRIVATE - $ + php_standard_functions_cli + PROPERTIES + INCLUDE_DIRECTORIES $ + COMPILE_DEFINITIONS $ + LINK_LIBRARIES $ ) target_compile_definitions( php_standard_functions_cli PRIVATE - $ $<$>:ENABLE_CHROOT_FUNC> ) -target_compile_definitions( - php_standard_functions - PRIVATE $ -) - -target_link_libraries( - php_standard_functions_cli - PRIVATE $ -) -target_link_libraries( - php_standard_functions - PRIVATE $ -) # ext/standard functions objects based on the SAPI type. target_sources( @@ -578,6 +562,9 @@ target_sources( $>,$,$> ) +add_dependencies(php_standard_functions php_standard) +add_dependencies(php_standard_functions_cli php_standard) + ################################################################################ # Configuration header ################################################################################ diff --git a/cmake/main/CMakeLists.txt b/cmake/main/CMakeLists.txt index 1744790bd..2527498d7 100644 --- a/cmake/main/CMakeLists.txt +++ b/cmake/main/CMakeLists.txt @@ -1,23 +1,17 @@ #[=============================================================================[ PHP main binding. - -## INTERFACE target - -* `php` (alias `PHP::PHP`) is an INTERFACE library that ties PHP core, Zend - Engine and PHP extensions together and can be easily linked to SAPIs. #]=============================================================================] -include(FeatureSummary) +# Compile and link properties for all targets in this directory scope. +add_compile_definitions(ZEND_ENABLE_STATIC_TSRMLS_CACHE) +link_libraries(PHP::configuration) ################################################################################ # Add library. ################################################################################ add_library(php_main OBJECT) - -# These contain a list of built-in extensions based on the SAPI types. -add_library(php_main_internal_functions OBJECT internal_functions.c) -add_library(php_main_internal_functions_cli OBJECT internal_functions_cli.c) +add_library(PHP::main ALIAS php_main) target_sources( php_main @@ -108,194 +102,40 @@ target_sources( $<$>:${CMAKE_CURRENT_BINARY_DIR}/php_config.h> ) +################################################################################ +# Add usage requirements to PHP interface targets. +################################################################################ + target_compile_definitions( - php_main - PUBLIC + php_configuration + INTERFACE $<$:SAPI_EXPORTS> ) target_include_directories( - php_main + php_configuration INTERFACE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) -set_property( - TARGET - php_main - php_main_internal_functions - php_main_internal_functions_cli - APPEND - PROPERTY COMPILE_DEFINITIONS ZEND_ENABLE_STATIC_TSRMLS_CACHE -) - -# Add main PUBLIC/INTERFACE compile properties to configuration. -# Cleaner COMPILE_ONLY generator expression is available in CMake >= 3.27. -if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.27) - target_link_libraries(php_configuration INTERFACE $) -else() - target_include_directories( - php_configuration - INTERFACE - $ - ) - target_compile_definitions( - php_configuration - INTERFACE - $ - ) -endif() - -target_link_libraries(php_main PRIVATE PHP::configuration) -target_link_libraries(php_main_internal_functions PRIVATE PHP::configuration) -target_link_libraries(php_main_internal_functions_cli PRIVATE PHP::configuration) +target_link_libraries(php_sapi INTERFACE PHP::main) +target_sources(php_sapi INTERFACE $) ################################################################################ -# Add PHP::PHP. +# Create main/internal_functions*.c files with a list of static enabled PHP +# extensions based on the PHP SAPI type. ################################################################################ -add_library(php INTERFACE) -add_library(PHP::PHP ALIAS php) - -target_link_libraries( - php - INTERFACE - PHP::configuration - php_main - # If Zend is STATIC library link as whole archive, otherwise link normally. - $,STATIC_LIBRARY>,$,Zend::Zend> - $<$:PHP::windows> - PHP::extensions -) +add_library(php_main_internal_functions OBJECT internal_functions.c) +add_library(php_main_internal_functions_cli OBJECT internal_functions_cli.c) -# OBJECT libraries propagate only compile properties to static libraries without -# objects as there is no "linking" involved on the compiler level. This is a -# workaround using interface target sources to make PHP::PHP more intuitive to -# work with SAPIs. target_sources( - php + php_sapi INTERFACE - $ - - # Internal functions objects based on the SAPI type. $>,$,$> - - # If Zend is OBJECT library, add library objects as sources. - $<$,OBJECT_LIBRARY>:$> - - # If Zend is STATIC library, and linking to a STATIC library (SAPI), add - # library objects as sources. - $<$,STATIC_LIBRARY>,$,STATIC_LIBRARY>>:$> - - $<$:$> -) - -################################################################################ -# Add DTrace. -################################################################################ - -if(PHP_DTRACE) - message(CHECK_START "Checking for DTrace support") - - find_package(DTrace) - set_package_properties( - DTrace - PROPERTIES - TYPE REQUIRED - PURPOSE "Necessary to enable the DTrace support." - ) - - if(DTrace_FOUND) - dtrace_target( - php_dtrace - INPUT ${PHP_SOURCE_DIR}/Zend/zend_dtrace.d - HEADER ${PHP_BINARY_DIR}/Zend/zend_dtrace_gen.h - SOURCES - main.c - ${PHP_SOURCE_DIR}/Zend/zend_API.c - ${PHP_SOURCE_DIR}/Zend/zend_dtrace.c - ${PHP_SOURCE_DIR}/Zend/zend_exceptions.c - ${PHP_SOURCE_DIR}/Zend/zend_execute.c - ${PHP_SOURCE_DIR}/Zend/zend.c - INCLUDES - $ - ) - target_link_libraries(php_main PRIVATE DTrace::DTrace) - target_link_libraries(php INTERFACE php_dtrace) - - set(HAVE_DTRACE TRUE PARENT_SCOPE) - - message(CHECK_PASS "yes") - else() - message(CHECK_FAIL "no") - endif() -endif() -add_feature_info( - "DTrace" - PHP_DTRACE - "performance analysis and troubleshooting" -) - -################################################################################ -# Add Dmalloc. -################################################################################ - -if(PHP_DMALLOC) - message(CHECK_START "Checking for Dmalloc support") - - find_package(Dmalloc) - set_package_properties( - Dmalloc - PROPERTIES - TYPE REQUIRED - PURPOSE "Necessary to use Dmalloc memory debugger." - ) - - target_compile_definitions( - php_configuration - INTERFACE - $<$:DMALLOC_FUNC_CHECK> - ) - - target_link_libraries(php_main PRIVATE Dmalloc::Dmalloc) - - if(Dmalloc_FOUND) - message(CHECK_PASS "yes") - set(HAVE_DMALLOC TRUE PARENT_SCOPE) - else() - message(CHECK_FAIL "no") - endif() -endif() - -################################################################################ -# Create main/php_version.h. Template is based on the configure.ac. -################################################################################ - -cmake_path( - RELATIVE_PATH - CMAKE_CURRENT_SOURCE_DIR - BASE_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE relativeSourceDir ) -message(STATUS "Creating ${relativeSourceDir}/php_version.h") -file(CONFIGURE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/php_version.h CONTENT [[ -/* automatically generated by configure */ -/* edit configure.ac to change version number */ -#define PHP_MAJOR_VERSION @PHP_VERSION_MAJOR@ -#define PHP_MINOR_VERSION @PHP_VERSION_MINOR@ -#define PHP_RELEASE_VERSION @PHP_VERSION_PATCH@ -#define PHP_EXTRA_VERSION "@PHP_VERSION_LABEL@" -#define PHP_VERSION "@PHP_VERSION@" -#define PHP_VERSION_ID @PHP_VERSION_ID@ -]]) - -################################################################################ -# Create main/internal_functions*.c files with a list of static enabled PHP -# extensions based on the PHP SAPI type. -################################################################################ - block() set(includes "") set(includesCli "") @@ -351,6 +191,29 @@ block() file(GENERATE OUTPUT internal_functions_cli.c CONTENT "${content}") endblock() +################################################################################ +# Create main/php_version.h. Template is based on the configure.ac. +################################################################################ + +cmake_path( + RELATIVE_PATH + CMAKE_CURRENT_SOURCE_DIR + BASE_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE relativeSourceDir +) + +message(STATUS "Creating ${relativeSourceDir}/php_version.h") +file(CONFIGURE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/php_version.h CONTENT [[ +/* automatically generated by configure */ +/* edit configure.ac to change version number */ +#define PHP_MAJOR_VERSION @PHP_VERSION_MAJOR@ +#define PHP_MINOR_VERSION @PHP_VERSION_MINOR@ +#define PHP_RELEASE_VERSION @PHP_VERSION_PATCH@ +#define PHP_EXTRA_VERSION "@PHP_VERSION_LABEL@" +#define PHP_VERSION "@PHP_VERSION@" +#define PHP_VERSION_ID @PHP_VERSION_ID@ +]]) + ################################################################################ # Generate configuration headers. ################################################################################ diff --git a/cmake/sapi/apache2handler/CMakeLists.txt b/cmake/sapi/apache2handler/CMakeLists.txt index 438aabb1c..e3602ddcf 100644 --- a/cmake/sapi/apache2handler/CMakeLists.txt +++ b/cmake/sapi/apache2handler/CMakeLists.txt @@ -109,7 +109,7 @@ endif() target_link_libraries( php_apache2handler PRIVATE - PHP::PHP + PHP::SAPI Apache::Apache ) diff --git a/cmake/sapi/cgi/CMakeLists.txt b/cmake/sapi/cgi/CMakeLists.txt index e03a3e4b7..4eec0cdd1 100644 --- a/cmake/sapi/cgi/CMakeLists.txt +++ b/cmake/sapi/cgi/CMakeLists.txt @@ -41,7 +41,7 @@ target_compile_definitions(php_cgi PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE) target_link_libraries( php_cgi PRIVATE - PHP::PHP + PHP::SAPI $<$:ws2_32;kernel32;advapi32> ) diff --git a/cmake/sapi/cli/CMakeLists.txt b/cmake/sapi/cli/CMakeLists.txt index 00ae99bab..437cdc4cb 100644 --- a/cmake/sapi/cli/CMakeLists.txt +++ b/cmake/sapi/cli/CMakeLists.txt @@ -102,7 +102,7 @@ target_compile_definitions( target_link_libraries( php_cli PRIVATE - PHP::PHP + PHP::SAPI $<$:ws2_32;shell32> ) @@ -158,7 +158,7 @@ if(SAPI_CLI_WIN_NO_CONSOLE) target_link_libraries( php_cli_win_no_console PRIVATE - PHP::PHP + PHP::SAPI shell32 ) diff --git a/cmake/sapi/embed/CMakeLists.txt b/cmake/sapi/embed/CMakeLists.txt index 0265e9a30..7e9fb1aac 100644 --- a/cmake/sapi/embed/CMakeLists.txt +++ b/cmake/sapi/embed/CMakeLists.txt @@ -47,7 +47,7 @@ target_sources( target_link_libraries( php_embed PRIVATE - PHP::PHP + PHP::SAPI ) target_compile_definitions(php_embed PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE) diff --git a/cmake/sapi/fpm/CMakeLists.txt b/cmake/sapi/fpm/CMakeLists.txt index 6e7af9159..89aee6967 100644 --- a/cmake/sapi/fpm/CMakeLists.txt +++ b/cmake/sapi/fpm/CMakeLists.txt @@ -188,7 +188,7 @@ endif() ################################################################################ add_executable(php_fpm) -add_executable(PHP:fpm ALIAS php_fpm) +add_executable(PHP::fpm ALIAS php_fpm) target_sources( php_fpm @@ -235,7 +235,7 @@ target_compile_definitions(php_fpm PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE) target_link_libraries( php_fpm PRIVATE - PHP::PHP + PHP::SAPI ) set_target_properties( diff --git a/cmake/sapi/fuzzer/CMakeLists.txt b/cmake/sapi/fuzzer/CMakeLists.txt index 99af7074e..b8b686b0e 100644 --- a/cmake/sapi/fuzzer/CMakeLists.txt +++ b/cmake/sapi/fuzzer/CMakeLists.txt @@ -139,7 +139,7 @@ set_target_properties( target_link_libraries( php_fuzzer PRIVATE - PHP::PHP + PHP::SAPI ) install(TARGETS php_fuzzer RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/cmake/sapi/litespeed/CMakeLists.txt b/cmake/sapi/litespeed/CMakeLists.txt index 55ab68f4b..5b9ab223a 100644 --- a/cmake/sapi/litespeed/CMakeLists.txt +++ b/cmake/sapi/litespeed/CMakeLists.txt @@ -46,7 +46,7 @@ target_sourceS( target_link_libraries( php_litespeed PRIVATE - PHP::PHP + PHP::SAPI ) set_target_properties( diff --git a/cmake/sapi/phpdbg/CMakeLists.txt b/cmake/sapi/phpdbg/CMakeLists.txt index 974bbfdbb..0d2744e72 100644 --- a/cmake/sapi/phpdbg/CMakeLists.txt +++ b/cmake/sapi/phpdbg/CMakeLists.txt @@ -125,7 +125,7 @@ set(php_phpdbg_sources ) add_executable(php_phpdbg ${php_phpdbg_sources}) -add_executable(PHP:phpdbg ALIAS php_phpdbg) +add_executable(PHP::phpdbg ALIAS php_phpdbg) target_compile_definitions( php_phpdbg @@ -138,7 +138,7 @@ target_compile_definitions( target_link_libraries( php_phpdbg PRIVATE - PHP::PHP + PHP::SAPI $<$:ws2_32;user32> ) @@ -228,27 +228,15 @@ if(SAPI_PHPDBG_SHARED) php_phpdbg_shared PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE - $ $<$:YY_NO_UNISTD_H> $,PHPDBG_DEBUG=1,PHPDBG_DEBUG=0> ) - target_include_directories( - php_phpdbg_shared - PRIVATE - $ - ) - - target_compile_options( - php_phpdbg_shared - PRIVATE $ - ) - target_link_libraries( php_phpdbg_shared PRIVATE # TODO: fix this better in the future (building with -fPIC etc). - PHP::PHP + PHP::SAPI $<$:ws2_32;user32> ) endif() diff --git a/cmake/win32/CMakeLists.txt b/cmake/win32/CMakeLists.txt index dcf293001..e2b608edd 100644 --- a/cmake/win32/CMakeLists.txt +++ b/cmake/win32/CMakeLists.txt @@ -67,6 +67,12 @@ target_sources( ${CMAKE_CURRENT_BINARY_DIR}/wsyslog.h ) +target_link_libraries(php_windows PRIVATE PHP::configuration) + +################################################################################ +# Add usage requirements to PHP interface targets. +################################################################################ + target_compile_definitions( php_configuration INTERFACE @@ -89,8 +95,6 @@ target_compile_options( $<$:/wd4996> ) -target_link_libraries(php_windows PRIVATE PHP::configuration) - target_link_libraries( php_configuration INTERFACE @@ -105,6 +109,9 @@ target_link_libraries( ws2_32 ) +target_link_libraries(php_sapi INTERFACE PHP::windows) +target_sources(php_sapi INTERFACE $) + ################################################################################ # Generate wsyslog.h file with message compiler (mc). ################################################################################