@@ -11,10 +11,13 @@ Configure the `embed` PHP SAPI.
1111Enable the embedded PHP SAPI module for embedding PHP into application using C
1212bindings.
1313
14- The embed library is then located in the `sapi/embed` directory as a shared
15- library `libphp.so`, or a static library `libphp.a`, which can be further used
16- in other applications. It exposes PHP API as C library object for other programs
17- to use PHP.
14+ The embed library is then located in the `sapi/embed` directory:
15+ * as a shared library `libphp.so` (\*nix), or `libphp.dylib` (macOS), or
16+ `phpembed.dll` (Windows)
17+ * and a static library `libphp.a` (\*nix), or `phpembed.lib` (Windows)
18+
19+ which can be further used in other applications. It exposes PHP API as C library
20+ for other programs to use PHP.
1821#]=============================================================================]
1922
2023include (FeatureSummary)
@@ -52,10 +55,25 @@ foreach(target IN ITEMS php_sapi_embed php_sapi_embed_shared)
5255
5356 target_compile_definitions (${target} PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE)
5457
58+ if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
59+ set_target_properties (
60+ ${target}
61+ PROPERTIES
62+ PREFIX ""
63+ OUTPUT_NAME ${PHP_PROGRAM_PREFIX} phpembed${PHP_PROGRAM_SUFFIX}
64+ )
65+ else ()
66+ set_target_properties (
67+ ${target}
68+ PROPERTIES
69+ PREFIX lib
70+ OUTPUT_NAME ${PHP_PROGRAM_PREFIX} php${PHP_PROGRAM_SUFFIX}
71+ )
72+ endif ()
73+
5574 set_target_properties (
5675 ${target}
5776 PROPERTIES
58- OUTPUT_NAME libphp
5977 ENABLE_EXPORTS TRUE # TODO: Check if there's a better solution.
6078 PHP_CLI TRUE
6179 )
@@ -81,6 +99,7 @@ php_pkgconfig_generate_pc(
8199 PHP_CONFIG_FILE_PATH "$<PATH:ABSOLUTE_PATH,NORMALIZE,${PHP_CONFIG_FILE_PATH} ,$<INSTALL_PREFIX>>"
82100 PHP_DEBUG "$<IF:$<CONFIG:Debug,DebugAssertions>,yes,no>"
83101 PHP_THREAD_SAFETY "$<IF:$<BOOL:$<TARGET_PROPERTY:PHP::config,PHP_THREAD_SAFETY>>,yes,no>"
102+ PHP_EMBED_SAPI_NAME "$<GENEX_EVAL:$<TARGET_PROPERTY:php_sapi_embed_shared,OUTPUT_NAME>>"
84103)
85104
86105install (
0 commit comments