@@ -271,6 +271,29 @@ if(PHP_DMALLOC)
271271 endif ()
272272endif ()
273273
274+ ################################################################################
275+ # Create main/php_version.h. Template is based on the configure.ac.
276+ ################################################################################
277+
278+ cmake_path(
279+ RELATIVE_PATH
280+ CMAKE_CURRENT_SOURCE_DIR
281+ BASE_DIRECTORY ${CMAKE_SOURCE_DIR}
282+ OUTPUT_VARIABLE relativeSourceDir
283+ )
284+
285+ message (STATUS "Creating ${relativeSourceDir} /php_version.h" )
286+ file (CONFIGURE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR} /php_version.h CONTENT [[
287+ /* automatically generated by configure */
288+ /* edit configure.ac to change version number */
289+ #define PHP_MAJOR_VERSION @PHP_VERSION_MAJOR@
290+ #define PHP_MINOR_VERSION @PHP_VERSION_MINOR@
291+ #define PHP_RELEASE_VERSION @PHP_VERSION_PATCH@
292+ #define PHP_EXTRA_VERSION "@PHP_VERSION_LABEL@"
293+ #define PHP_VERSION "@PHP_VERSION@"
294+ #define PHP_VERSION_ID @PHP_VERSION_ID@
295+ ]])
296+
274297################################################################################
275298# Create main/internal_functions*.c files with a list of static enabled PHP
276299# extensions based on the PHP SAPI type.
@@ -319,17 +342,17 @@ block()
319342 RELATIVE_PATH
320343 CMAKE_CURRENT_BINARY_DIR
321344 BASE_DIRECTORY ${CMAKE_BINARY_DIR}
322- OUTPUT_VARIABLE relativeDir
345+ OUTPUT_VARIABLE relativeBinaryDir
323346 )
324347
325348 set (EXT_INCLUDE_CODE "${includes} " )
326349 set (EXT_MODULE_PTRS "${pointers} " )
327- message (STATUS "Creating ${relativeDir } /internal_functions.c" )
350+ message (STATUS "Creating ${relativeBinaryDir } /internal_functions.c" )
328351 configure_file (internal_functions.c.in internal_functions.c)
329352
330353 set (EXT_INCLUDE_CODE "${includesCli} " )
331354 set (EXT_MODULE_PTRS "${pointersCli} " )
332- message (STATUS "Creating ${relativeDir } /internal_functions_cli.c" )
355+ message (STATUS "Creating ${relativeBinaryDir } /internal_functions_cli.c" )
333356 configure_file (internal_functions.c.in internal_functions_cli.c)
334357endblock()
335358
@@ -420,12 +443,6 @@ function(_php_main_create_files)
420443 set (DEFAULT_SHORT_OPEN_TAG "0" )
421444 endif ()
422445
423- message (STATUS "Creating main/php_version.h" )
424- configure_file (
425- main/cmake/php_version.h.in
426- ${PHP_SOURCE_DIR} /main/php_version.h
427- )
428-
429446 # Add sapis configuration.
430447 set (config "" )
431448 get_property (sapis GLOBAL PROPERTY PHP_SAPIS)
@@ -475,7 +492,7 @@ function(_php_main_create_files)
475492 GENERATE
476493 # TODO: Multi-config generators need to write separate files.
477494 #OUTPUT $<CONFIG>/main/build-defs.h
478- OUTPUT ${PHP_BINARY_DIR} / main/build -defs.h
495+ OUTPUT main/build -defs.h
479496 CONTENT "${content} "
480497 )
481498
@@ -526,7 +543,7 @@ function(_php_main_create_files)
526543 GENERATE
527544 # TODO: Multi-config generators need to write separate files.
528545 #OUTPUT $<CONFIG>/main/${file}
529- OUTPUT ${PHP_BINARY_DIR} / main/${file}
546+ OUTPUT main/${file}
530547 CONTENT "${content} "
531548 )
532549endfunction ()
0 commit comments