Skip to content

Commit cefdde8

Browse files
committed
Add minor various improvements
- Use generator expression for the prehistoric _USE_32BIT_TIME_T compile definition. - Move Zend Engine configuration a bit to match the configuration flow from CMakeLists.txt.
1 parent 9ff4df0 commit cefdde8

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

cmake/main/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,6 @@ function(_php_main_create_files)
356356
message(STATUS "Creating main/php_version.h")
357357
configure_file(main/php_version.h.in main/php_version.h @ONLY)
358358

359-
# Add Zend Engine configuration.
360-
file(READ ${CMAKE_CURRENT_BINARY_DIR}/Zend/CMakeFiles/zend_config.h config)
361-
string(STRIP "${config}" ZEND_CONFIGURATION)
362-
363359
# Add sapis configuration.
364360
set(config "")
365361
get_cmake_property(sapis PHP_SAPIS)
@@ -388,6 +384,10 @@ function(_php_main_create_files)
388384
endforeach()
389385
string(STRIP "${config}" PHP_EXTENSIONS_CONFIGURATION)
390386

387+
# Add Zend Engine configuration.
388+
file(READ ${CMAKE_CURRENT_BINARY_DIR}/Zend/CMakeFiles/zend_config.h config)
389+
string(STRIP "${config}" ZEND_CONFIGURATION)
390+
391391
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
392392
set(PHP_CONFIG_H_WINDOWS 1)
393393
set(file config.w32.h)

cmake/main/php_config.cmake.h.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -701,12 +701,6 @@
701701
/* Define to 1 when using musl libc. */
702702
#cmakedefine __MUSL__ 1
703703

704-
/*****************************************************************************
705-
Zend Engine configuration
706-
****************************************************************************/
707-
708-
@ZEND_CONFIGURATION@
709-
710704
/*****************************************************************************
711705
PHP SAPIs configuration
712706
****************************************************************************/
@@ -719,6 +713,12 @@
719713

720714
@PHP_EXTENSIONS_CONFIGURATION@
721715

716+
/*****************************************************************************
717+
Zend Engine configuration
718+
****************************************************************************/
719+
720+
@ZEND_CONFIGURATION@
721+
722722
#if @PHP_CONFIG_H_WINDOWS@
723723
/* The following build system related configuration values are on *nix
724724
systems defined in the main/build-defs.h and JScript Windows build system

cmake/win32/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ target_compile_definitions(
6969
_MBCS
7070
_USE_MATH_DEFINES
7171
PHP_EXPORTS
72+
# The time_t defaults to 64-bit. Force 32-bit time_t on 32-bit architecture.
73+
# This was historically added to PHP as Visual Studio 2005 set 64-bit time_t
74+
# by default and it would break 3rdParty libs that were built with older
75+
# compilers. This and duplicate definition in the configuration header
76+
# should be removed at some point.
77+
$<$<EQUAL:${CMAKE_SIZEOF_VOID_P},4>:_USE_32BIT_TIME_T=1>
7278
)
7379

7480
# MS deprecated ANSI stdio and similar functions. Disable warnings.
@@ -79,11 +85,6 @@ target_compile_options(
7985
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/wd4996>
8086
)
8187

82-
# The time_t defaults to 64-bit. Force 32-bit time_t on 32-bit architecture.
83-
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
84-
target_compile_definitions(php_configuration INTERFACE _USE_32BIT_TIME_T=1)
85-
endif()
86-
8788
target_link_libraries(php_win32 PRIVATE PHP::configuration)
8889

8990
target_link_libraries(

0 commit comments

Comments
 (0)