Option to let clang use libc++.

This commit is contained in:
Chao Shen 2018-05-07 11:16:32 +08:00
parent 990d10a605
commit 78bf7c395e
No known key found for this signature in database
GPG Key ID: 0AD1776624A6084E

View File

@ -11,6 +11,7 @@ set(CLANG_DOWNLOAD_LOCATION ${CMAKE_BINARY_DIR}
option(SYSTEM_CLANG "Use system installation of Clang instead of \
downloading Clang" OFF)
option(ASAN "Compile with address sanitizers" OFF)
option(CLANG_USE_BUNDLED_LIBC++ "Let Clang use bundled libc++" OFF)
# Sources for the executable are specified at end of CMakeLists.txt
add_executable(ccls "")
@ -81,6 +82,14 @@ if(NOT SYSTEM_CLANG)
download_and_extract_clang(${CLANG_VERSION} ${CLANG_DOWNLOAD_LOCATION})
# Used by FindClang
set(CLANG_ROOT ${DOWNLOADED_CLANG_DIR})
if(CLANG_USE_BUNDLED_LIBC++)
target_compile_options(ccls PRIVATE -stdlib=libc++)
target_link_libraries(ccls PRIVATE ${CLANG_ROOT}/lib/libc++.a
${CLANG_ROOT}/lib/libc++abi.a
${CLANG_ROOT}/lib/libc++experimental.a)
endif()
else()
message(STATUS "Using system Clang")
endif()