@@ -298,6 +298,29 @@ if(PHP_DMALLOC)
298298 endif ()
299299endif ()
300300
301+ ################################################################################
302+ # Create main/php_version.h. Template is based on the configure.ac.
303+ ################################################################################
304+
305+ cmake_path(
306+ RELATIVE_PATH
307+ CMAKE_CURRENT_SOURCE_DIR
308+ BASE_DIRECTORY ${CMAKE_SOURCE_DIR}
309+ OUTPUT_VARIABLE relativeSourceDir
310+ )
311+
312+ message (STATUS "Creating ${relativeSourceDir} /php_version.h" )
313+ file (CONFIGURE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR} /php_version.h CONTENT [[
314+ /* automatically generated by configure */
315+ /* edit configure.ac to change version number */
316+ #define PHP_MAJOR_VERSION @PHP_VERSION_MAJOR@
317+ #define PHP_MINOR_VERSION @PHP_VERSION_MINOR@
318+ #define PHP_RELEASE_VERSION @PHP_VERSION_PATCH@
319+ #define PHP_EXTRA_VERSION "@PHP_VERSION_LABEL@"
320+ #define PHP_VERSION "@PHP_VERSION@"
321+ #define PHP_VERSION_ID @PHP_VERSION_ID@
322+ ]])
323+
301324################################################################################
302325# Create main/internal_functions*.c files with a list of static enabled PHP
303326# extensions based on the PHP SAPI type.
@@ -346,17 +369,17 @@ block()
346369 RELATIVE_PATH
347370 CMAKE_CURRENT_BINARY_DIR
348371 BASE_DIRECTORY ${CMAKE_BINARY_DIR}
349- OUTPUT_VARIABLE relativeDir
372+ OUTPUT_VARIABLE relativeBinaryDir
350373 )
351374
352375 set (EXT_INCLUDE_CODE "${includes} " )
353376 set (EXT_MODULE_PTRS "${pointers} " )
354- message (STATUS "Creating ${relativeDir } /internal_functions.c" )
377+ message (STATUS "Creating ${relativeBinaryDir } /internal_functions.c" )
355378 configure_file (internal_functions.c.in internal_functions.c)
356379
357380 set (EXT_INCLUDE_CODE "${includesCli} " )
358381 set (EXT_MODULE_PTRS "${pointersCli} " )
359- message (STATUS "Creating ${relativeDir } /internal_functions_cli.c" )
382+ message (STATUS "Creating ${relativeBinaryDir } /internal_functions_cli.c" )
360383 configure_file (internal_functions.c.in internal_functions_cli.c)
361384endblock()
362385
@@ -447,12 +470,6 @@ function(_php_main_create_files)
447470 set (DEFAULT_SHORT_OPEN_TAG "0" )
448471 endif ()
449472
450- message (STATUS "Creating main/php_version.h" )
451- configure_file (
452- main/cmake/php_version.h.in
453- ${PHP_SOURCE_DIR} /main/php_version.h
454- )
455-
456473 # Add sapis configuration.
457474 set (config "" )
458475 get_property (sapis GLOBAL PROPERTY PHP_SAPIS)
@@ -502,7 +519,7 @@ function(_php_main_create_files)
502519 GENERATE
503520 # TODO: Multi-config generators need to write separate files.
504521 #OUTPUT $<CONFIG>/main/build-defs.h
505- OUTPUT ${PHP_BINARY_DIR} / main/build -defs.h
522+ OUTPUT main/build -defs.h
506523 CONTENT "${content} "
507524 )
508525
@@ -553,7 +570,7 @@ function(_php_main_create_files)
553570 GENERATE
554571 # TODO: Multi-config generators need to write separate files.
555572 #OUTPUT $<CONFIG>/main/${file}
556- OUTPUT ${PHP_BINARY_DIR} / main/${file}
573+ OUTPUT main/${file}
557574 CONTENT "${content} "
558575 )
559576endfunction ()
0 commit comments