mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Add CLANG_USE_BUNDLED_LIBC++ to cmake
This commit is contained in:
parent
ba56663055
commit
6c57f9663e
@ -11,6 +11,7 @@ set(CLANG_DOWNLOAD_LOCATION ${CMAKE_BINARY_DIR}
|
|||||||
option(SYSTEM_CLANG "Use system installation of Clang instead of \
|
option(SYSTEM_CLANG "Use system installation of Clang instead of \
|
||||||
downloading Clang" OFF)
|
downloading Clang" OFF)
|
||||||
option(ASAN "Compile with address sanitizers" 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
|
# Sources for the executable are specified at end of CMakeLists.txt
|
||||||
add_executable(ccls "")
|
add_executable(ccls "")
|
||||||
@ -81,6 +82,16 @@ if(NOT SYSTEM_CLANG)
|
|||||||
download_and_extract_clang(${CLANG_VERSION} ${CLANG_DOWNLOAD_LOCATION})
|
download_and_extract_clang(${CLANG_VERSION} ${CLANG_DOWNLOAD_LOCATION})
|
||||||
# Used by FindClang
|
# Used by FindClang
|
||||||
set(CLANG_ROOT ${DOWNLOADED_CLANG_DIR})
|
set(CLANG_ROOT ${DOWNLOADED_CLANG_DIR})
|
||||||
|
|
||||||
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang AND CLANG_USE_BUNDLED_LIBC++)
|
||||||
|
message(STATUS "Using bundled libc++")
|
||||||
|
target_compile_options(ccls PRIVATE -stdlib=libc++)
|
||||||
|
target_include_directories(ccls PRIVATE ${CLANG_ROOT}/include/c++/v1)
|
||||||
|
target_link_libraries(ccls PRIVATE ${CLANG_ROOT}/lib/libc++.a
|
||||||
|
${CLANG_ROOT}/lib/libc++abi.a
|
||||||
|
${CLANG_ROOT}/lib/libc++experimental.a)
|
||||||
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "Using system Clang")
|
message(STATUS "Using system Clang")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user