Skip to content

Commit d4a669a

Browse files
committed
Use target_compile_features() to set C++ standard
This is a better way to enable C++ standard for extensions in this case. It errors out if C++ compiler doesn't support required standard and it can be also controlled from the parent project using CMAKE_CXX_STANDARD variable or through linking. The stricter and newer requirement is applied in case of different configurations. Using PRIVATE scope to limit this requirement to extension scope only.
1 parent 3a28127 commit d4a669a

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

cmake/ext/intl/CMakeLists.txt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,9 @@ set_package_properties(
199199
)
200200

201201
if(ICU_VERSION VERSION_GREATER_EQUAL 74)
202-
set_target_properties(
203-
php_ext_intl
204-
PROPERTIES
205-
CXX_STANDARD 17
206-
CXX_STANDARD_REQUIRED TRUE
207-
)
202+
target_compile_features(php_ext_intl PRIVATE cxx_std_17)
208203
else()
209-
set_target_properties(
210-
php_ext_intl
211-
PROPERTIES
212-
CXX_STANDARD 11
213-
CXX_STANDARD_REQUIRED TRUE
214-
)
204+
target_compile_features(php_ext_intl PRIVATE cxx_std_11)
215205
endif()
216206

217207
target_link_libraries(php_ext_intl PRIVATE ICU::io ICU::uc ICU::i18n)

0 commit comments

Comments
 (0)