From a5ddca7a9ca3b92855f9a0f37ee4c2b4a35346f2 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 3 Mar 2018 22:44:32 +0300 Subject: [PATCH] Added CMake option to link with custom libc++ [#CLICKHOUSE-2] --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf546c72f83..ca4be1f5893 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,8 @@ if (ARCH_LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GLIBC_COMPATIBILITY_LINK_FLAGS} ${CXX11_ABI_FLAGS}") option (USE_LIBCXX "Use libc++ and libc++abi instead of libstdc++ (only make sense on Linux with Clang)" ${HAVE_LIBCXX}) + set (LIBCXX_PATH "" CACHE STRING "Use custom path for libc++. It should be used for MSan.") + if (USE_LIBCXX) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") # Ok for clang6, for older can cause 'not used option' warning set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_LIBCPP_DEBUG=0") # More checks in debug build. @@ -170,6 +172,11 @@ if (ARCH_LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") else () link_libraries (-stdlib=libc++ c++ c++abi) endif () + + if (LIBCXX_PATH) +# include_directories (BEFORE SYSTEM "${LIBCXX_PATH}/include" "${LIBCXX_PATH}/include/c++/v1") + link_directories ("${LIBCXX_PATH}/lib") + endif () endif () endif ()