Skip to content

Commit 579b04d

Browse files
committed
Sync with upstream: Add -fwrapv compile option to ext/date/lib
1 parent a80ee1e commit 579b04d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

cmake/ext/date/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,23 @@ add_feature_info(
2323

2424
add_library(php_date OBJECT)
2525

26+
set(phpDateSources php_date.c)
27+
2628
target_sources(
2729
php_date
2830
PRIVATE
29-
php_date.c
31+
${phpDateSources}
3032
php_date.stub.php
3133
PUBLIC
3234
FILE_SET HEADERS
3335
FILES
3436
php_date.h
3537
)
3638

37-
target_compile_definitions(php_date PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE)
39+
set_source_files_properties(
40+
${phpDateSources}
41+
PROPERTIES COMPILE_DEFINITIONS ZEND_ENABLE_STATIC_TSRMLS_CACHE
42+
)
3843

3944
target_compile_options(
4045
php_date

cmake/ext/date/lib/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ cmake_minimum_required(VERSION 3.25...3.31)
1717

1818
project(Timelib LANGUAGES C)
1919

20+
include(CheckCompilerFlag)
2021
include(CheckIncludeFile)
2122

2223
if(NOT TIMELIB_TARGET)
@@ -64,6 +65,15 @@ target_compile_definitions(
6465
HAVE_STRTOLL
6566
)
6667

68+
check_compiler_flag(C -fwrapv _HAVE_FWRAPV)
69+
if(_HAVE_FWRAPV)
70+
set_source_files_properties(
71+
${timelibSources}
72+
TARGET_DIRECTORY ${TIMELIB_TARGET}
73+
PROPERTIES COMPILE_OPTIONS -fwrapv
74+
)
75+
endif()
76+
6777
check_include_file(io.h HAVE_IO_H)
6878

6979
cmake_path(

0 commit comments

Comments
 (0)