From 6f6d9a8cdbb17ac0247c31f61484c6f164e1b96d Mon Sep 17 00:00:00 2001 From: Kyler Clonts Date: Mon, 11 Nov 2024 19:26:20 -0500 Subject: [PATCH] add option to disable the workaround enabled for clang + libstdc++ Signed-off-by: Kyler Clonts --- CMakeLists.txt | 1 + clickhouse/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ae1ca04..24b71bab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ OPTION (WITH_SYSTEM_CITYHASH "Use system cityhash" OFF) OPTION (WITH_SYSTEM_ZSTD "Use system ZSTD" OFF) OPTION (DEBUG_DEPENDENCIES "Print debug info about dependencies duting build" ON) OPTION (CHECK_VERSION "Check that version number corresponds to git tag, usefull in CI/CD to validate that new version published on GitHub has same version in sources" OFF) +OPTION (DISABLE_CLANG_LIBC_WORKAROUND "Disable linking compiler-rt & gcc_s if using clang & libstdc++" OFF) PROJECT (CLICKHOUSE-CLIENT VERSION "${CLICKHOUSE_CPP_VERSION}" diff --git a/clickhouse/CMakeLists.txt b/clickhouse/CMakeLists.txt index 96c0f6a5..487e295d 100644 --- a/clickhouse/CMakeLists.txt +++ b/clickhouse/CMakeLists.txt @@ -89,7 +89,7 @@ if (MSVC) # remove in 3.0 add_compile_options(/wd4996) else() - set(cxx_extra_wall "-Wempty-body -Wconversion -Wreturn-type -Wparentheses -Wuninitialized -Wunreachable-code -Wunused-function -Wunused-value -Wunused-variable") + set(cxx_extra_wall "-Wempty-body -Wconversion -Wreturn-type -Wparentheses -Wuninitialized -Wunreachable-code -Wunused-function -Wunused-value -Wunused-variable") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_extra_wall}") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") @@ -130,7 +130,7 @@ ELSE () ENDIF () -IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT DISABLE_CLANG_LIBC_WORKAROUND) INCLUDE (CheckCXXSourceCompiles) CHECK_CXX_SOURCE_COMPILES("#include \nint main() { return __GLIBCXX__ != 0; }"