@@ -51,18 +51,25 @@ TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static
5151)
5252
5353IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
54- # there is a problem with __builtin_mul_overflow call at link time
55- # the error looks like: ... undefined reference to `__muloti4' ...
56- # caused by clang bug https://bugs.llvm.org/show_bug.cgi?id=16404
57- # explicit linking to compiler-rt allows to workaround the problem
58- set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --rtlib=compiler-rt" )
59-
60- # some workaround for linking issues on linux:
61- # /usr/bin/ld: CMakeFiles/simple-test.dir/main.cpp.o: undefined reference to symbol '_Unwind_Resume@@GCC_3.0'
62- # /usr/bin/ld: /lib/x86_64-linux-gnu/libgcc_s.so.1: error adding symbols: DSO missing from command line
63- # FIXME: that workaround breaks clang build on mingw
64- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib gcc_s)
65- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static gcc_s)
54+ INCLUDE (CheckCXXSourceCompiles)
55+
56+ CHECK_CXX_SOURCE_COMPILES("#include <bits/c++config.h>\n int main() { return __GLIBCXX__ != 0; }"
57+ BUILDING_WITH_LIB_STDCXX)
58+
59+ IF (BUILDING_WITH_LIB_STDCXX)
60+ # there is a problem with __builtin_mul_overflow call at link time
61+ # the error looks like: ... undefined reference to `__muloti4' ...
62+ # caused by clang bug https://bugs.llvm.org/show_bug.cgi?id=16404
63+ # explicit linking to compiler-rt allows to workaround the problem
64+ SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --rtlib=compiler-rt" )
65+
66+ # some workaround for linking issues on linux:
67+ # /usr/bin/ld: CMakeFiles/simple-test.dir/main.cpp.o: undefined reference to symbol '_Unwind_Resume@@GCC_3.0'
68+ # /usr/bin/ld: /lib/x86_64-linux-gnu/libgcc_s.so.1: error adding symbols: DSO missing from command line
69+ # FIXME: that workaround breaks clang build on mingw
70+ TARGET_LINK_LIBRARIES (clickhouse-cpp-lib gcc_s)
71+ TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static gcc_s)
72+ ENDIF ()
6673ENDIF ()
6774
6875INSTALL (TARGETS clickhouse-cpp-lib clickhouse-cpp-lib-static
0 commit comments