mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 18:37:15 +02:00
build: overriding of std::format
support for clang-17+ with libc++ added
This commit is contained in:
@ -83,16 +83,15 @@ check_cxx_feature_supported(__cpp_lib_format ${projectPrefix}LIB_FORMAT_SUPPORTE
|
||||
check_cxx_feature_supported("__cpp_constexpr >= 202211L" ${projectPrefix}STATIC_CONSTEXPR_VARS_IN_CONSTEXPR_FUNCTIONS)
|
||||
check_cxx_feature_supported(__cpp_explicit_this_parameter ${projectPrefix}EXPLICIT_THIS_PARAMETER_SUPPORTED)
|
||||
|
||||
# libc++ has a basic supports for std::format but does not set __cpp_lib_format
|
||||
# https://github.com/llvm/llvm-project/issues/77773
|
||||
if(NOT ${projectPrefix}LIB_FORMAT_SUPPORTED AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "17" AND ${projectPrefix}LIBCXX)
|
||||
message(STATUS "Clang 17+ with libc++ detected, overriding `std::format` support")
|
||||
set(${projectPrefix}LIB_FORMAT_SUPPORTED 1)
|
||||
endif()
|
||||
|
||||
# validate settings
|
||||
if(NOT ${projectPrefix}API_FREESTANDING
|
||||
AND "${projectPrefix}API_STD_FORMAT"
|
||||
AND NOT
|
||||
(${projectPrefix}LIB_FORMAT_SUPPORTED
|
||||
# libc++ has a basic supports for std::format but does not set __cpp_lib_format
|
||||
# https://github.com/llvm/llvm-project/issues/77773
|
||||
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "17"
|
||||
AND ${projectPrefix}LIBCXX))
|
||||
)
|
||||
if(NOT ${projectPrefix}API_FREESTANDING AND "${projectPrefix}API_STD_FORMAT" AND NOT ${projectPrefix}LIB_FORMAT_SUPPORTED)
|
||||
message(FATAL_ERROR "`std::format` enabled but not supported")
|
||||
endif()
|
||||
|
||||
|
Reference in New Issue
Block a user