@@ -34,15 +34,11 @@ function(_php_stubs_get_php_command result)
3434 endif ()
3535 endif ()
3636
37- set (command )
38-
3937 if (NOT CMAKE_CROSSCOMPILING )
4038 set (command $<TARGET_FILE:php_cli>)
4139 elseif (CMAKE_CROSSCOMPILING AND CMAKE_CROSSCOMPILING_EMULATOR)
4240 set (command ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:php_cli>)
43- endif ()
44-
45- if (NOT command )
41+ else ()
4642 return (PROPAGATE ${result} )
4743 endif ()
4844
@@ -91,13 +87,13 @@ endif()
9187file (
9288 COPY
9389 ${PROJECT_SOURCE_DIR} /build /gen_stub.php
94- DESTINATION ${PROJECT_BINARY_DIR} /build
90+ DESTINATION ${PROJECT_BINARY_DIR} /CMakeFiles/php_stubs
9591)
9692
9793block()
98- _php_stubs_get_php_command(command )
94+ _php_stubs_get_php_command(PHP_COMMAND )
9995
100- if (NOT command )
96+ if (NOT PHP_COMMAND )
10197 return ()
10298 endif ()
10399
@@ -116,10 +112,13 @@ block()
116112 endif ()
117113 endforeach ()
118114
115+ set (PHP_SOURCES "$<JOIN:$<REMOVE_DUPLICATES:${stubs} >,$<SEMICOLON>>" )
116+ file (READ ${CMAKE_CURRENT_LIST_DIR} /Stubs/PHPStubsGenerator.cmake.in content )
117+ string (CONFIGURE "${content} " content @ONLY)
119118 file (
120119 GENERATE
121- OUTPUT ${PROJECT_BINARY_DIR} /CMakeFiles/php_stubs.txt
122- CONTENT "$<JOIN:$<REMOVE_DUPLICATES: ${stubs} >,$<SEMICOLON>> "
120+ OUTPUT ${PROJECT_BINARY_DIR} /CMakeFiles/php_stubs/PHPStubsGenerator.cmake
121+ CONTENT "${content} "
123122 )
124123
125124 if (NOT PHPSystem_EXECUTABLE)
@@ -130,9 +129,7 @@ block()
130129 php_stubs ${targetOptions}
131130 COMMAND
132131 ${CMAKE_COMMAND}
133- "-DPHP_STUBS=${PROJECT_BINARY_DIR} /CMakeFiles/php_stubs.txt"
134- "-DPHP_COMMAND=${command} ;${PROJECT_BINARY_DIR} /build/gen_stub.php"
135- -P ${CMAKE_CURRENT_LIST_DIR} /Stubs/RunCommand.cmake
132+ -P ${PROJECT_BINARY_DIR} /CMakeFiles/php_stubs/PHPStubsGenerator.cmake
136133 VERBATIM
137134 )
138135endblock()
0 commit comments