diff options
Diffstat (limited to 'cmake/compiler/clang')
-rw-r--r-- | cmake/compiler/clang/settings.cmake | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake index 716750d8715..1fe89542a84 100644 --- a/cmake/compiler/clang/settings.cmake +++ b/cmake/compiler/clang/settings.cmake @@ -13,6 +13,31 @@ else() message(STATUS "Clang: Minimum version required is ${CLANG_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!") endif() +# This tests for a bug in clang-7 that causes linkage to fail for 64-bit from_chars (in some configurations) +# If the clang requirement is bumped to >= clang-8, you can remove this check, as well as +# the associated ifdef block in src/common/Utilities/StringConvert.h +include(CheckCXXSourceCompiles) + +check_cxx_source_compiles(" +#include <charconv> +#include <cstdint> + +int main() +{ + uint64_t n; + char const c[] = \"0\"; + std::from_chars(c, c+1, n); + return static_cast<int>(n); +} +" CLANG_HAVE_PROPER_CHARCONV) + +if (NOT CLANG_HAVE_PROPER_CHARCONV) + message(STATUS "Clang: Detected from_chars bug for 64-bit integers, workaround enabled") + target_compile_definitions(trinity-compile-option-interface + INTERFACE + -DTRINITY_NEED_CHARCONV_WORKAROUND) +endif() + if(WITH_WARNINGS) target_compile_options(trinity-warning-interface INTERFACE |