@@ -52,6 +52,10 @@ if(NOT PHP_SAPI_CLI)
5252 return ()
5353endif ()
5454
55+ ################################################################################
56+ # Configuration checks.
57+ ################################################################################
58+
5559check_symbol_exists(setproctitle "unistd.h;stdlib.h" HAVE_SETPROCTITLE)
5660check_include_file(sys/pstat.h HAVE_SYS_PSTAT_H)
5761
@@ -74,6 +78,10 @@ else()
7478 message (CHECK_FAIL "no" )
7579endif ()
7680
81+ ################################################################################
82+ # The cli SAPI.
83+ ################################################################################
84+
7785add_executable (php_sapi_cli)
7886add_executable (PHP::sapi::cli ALIAS php_sapi_cli)
7987
@@ -102,7 +110,7 @@ target_compile_definitions(
102110target_link_libraries (
103111 php_sapi_cli
104112 PRIVATE
105- PHP::sapi
113+ $<BUILD_INTERFACE: PHP::sapi>
106114 $<$<PLATFORM_ID:Windows>:ws2_32;shell32>
107115)
108116
@@ -116,8 +124,7 @@ set_target_properties(
116124 php_sapi_cli
117125 PROPERTIES
118126 OUTPUT_NAME ${PHP_PROGRAM_PREFIX} php${PHP_PROGRAM_SUFFIX}
119- # TODO: Check if there's a better solution here:
120- ENABLE_EXPORTS TRUE
127+ ENABLE_EXPORTS TRUE # TODO: Check if there's a better solution.
121128 PHP_CLI TRUE
122129)
123130
@@ -130,6 +137,30 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
130137 )
131138endif ()
132139
140+ # Man documentation.
141+ block()
142+ set (program_prefix "${PHP_PROGRAM_PREFIX} " )
143+ configure_file (php.1.in php.1 @ONLY)
144+ endblock()
145+
146+ install (
147+ TARGETS php_sapi_cli
148+ RUNTIME
149+ DESTINATION ${CMAKE_INSTALL_BINDIR}
150+ FILE_SET HEADERS
151+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /${PHP_INCLUDE_PREFIX} /sapi/cli
152+ )
153+
154+ install (
155+ FILES ${CMAKE_CURRENT_BINARY_DIR} /php.1
156+ RENAME ${PHP_PROGRAM_PREFIX} php${PHP_PROGRAM_SUFFIX} .1
157+ DESTINATION ${CMAKE_INSTALL_MANDIR} /man1
158+ )
159+
160+ ################################################################################
161+ # The cli SAPI without console on Windows.
162+ ################################################################################
163+
133164if (PHP_SAPI_CLI_WIN_NO_CONSOLE)
134165 add_executable (php_sapi_cli_win)
135166 add_executable (PHP::sapi::cli_win ALIAS php_sapi_cli_win)
@@ -158,7 +189,7 @@ if(PHP_SAPI_CLI_WIN_NO_CONSOLE)
158189 target_link_libraries (
159190 php_sapi_cli_win
160191 PRIVATE
161- PHP::sapi
192+ $<BUILD_INTERFACE: PHP::sapi>
162193 shell32
163194 )
164195
@@ -169,24 +200,4 @@ if(PHP_SAPI_CLI_WIN_NO_CONSOLE)
169200 )
170201endif ()
171202
172- # Man documentation.
173- block()
174- set (program_prefix "${PHP_PROGRAM_PREFIX} " )
175- configure_file (php.1.in php.1 @ONLY)
176- endblock()
177-
178- install (
179- TARGETS php_sapi_cli
180- RUNTIME
181- DESTINATION ${CMAKE_INSTALL_BINDIR}
182- FILE_SET HEADERS
183- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /${PHP_INCLUDE_PREFIX} /sapi/cli
184- )
185-
186- install (
187- FILES ${CMAKE_CURRENT_BINARY_DIR} /php.1
188- RENAME ${PHP_PROGRAM_PREFIX} php${PHP_PROGRAM_SUFFIX} .1
189- DESTINATION ${CMAKE_INSTALL_MANDIR} /man1
190- )
191-
192203configure_file (cmake/config.h.in config.h)
0 commit comments