mirror of
https://github.com/MaskRay/ccls.git
synced 2025-06-07 08:44:55 +00:00
Fix builds for LLVM 9 (for LLVM build without BUILD_SHARED_LIBS=ON)
LLVM 9 officially ships the C++ libraries as a single library libclang-cpp.so. This makes ccls fail to link as the individual libraries libclangIndex, libclangFormat, etc. are no longer present. We use clang-cpp if it is available and fallback to the previously used behavior if clang-cpp is not available.
This commit is contained in:
parent
bfac2162eb
commit
7381df3bdd
@ -68,9 +68,18 @@ endif()
|
||||
|
||||
### Libraries
|
||||
|
||||
# LLVM >= 9 ships the C++ libraries by default in a single library libclang-cpp,
|
||||
# but this is not universally enabled on all distributions.
|
||||
# If clang-cpp is available, then link against it, otherwise link against the
|
||||
# individual clang libraries.
|
||||
find_package(Clang REQUIRED)
|
||||
|
||||
target_link_libraries(ccls PRIVATE
|
||||
if(TARGET clang-cpp AND NOT TARGET clangBasic)
|
||||
target_link_libraries(ccls PRIVATE
|
||||
clang-cpp
|
||||
)
|
||||
else()
|
||||
target_link_libraries(ccls PRIVATE
|
||||
clangIndex
|
||||
clangFormat
|
||||
clangTooling
|
||||
@ -84,7 +93,8 @@ target_link_libraries(ccls PRIVATE
|
||||
clangLex
|
||||
clangDriver
|
||||
clangBasic
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(LLVM_LINK_LLVM_DYLIB)
|
||||
target_link_libraries(ccls PRIVATE LLVM)
|
||||
|
Loading…
Reference in New Issue
Block a user