Browse Source

Add LLVM_ENABLE_RTTI (default: OFF) to allow linking against Arch Linux extra/{llvm,clang} (-DLLVM_ENABLE_RTTI=ON)

pull/517/head
Fangrui Song 6 years ago
parent
commit
b794b3606f
  1. 7
      CMakeLists.txt

7
CMakeLists.txt

@ -10,6 +10,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(LLVM_ENABLE_RTTI "-fno-rtti if OFF. This should match LLVM libraries" OFF)
option(CLANG_USE_BUNDLED_LIBC++ "Let Clang use bundled libc++" OFF) option(CLANG_USE_BUNDLED_LIBC++ "Let Clang use bundled libc++" OFF)
option(USE_SHARED_LLVM "Link against libLLVM.so instead separate LLVM{Option,Support,...}" OFF) option(USE_SHARED_LLVM "Link against libLLVM.so instead separate LLVM{Option,Support,...}" OFF)
@ -34,8 +35,12 @@ if(NOT CYGWIN)
set_property(TARGET ccls PROPERTY CXX_EXTENSIONS OFF) set_property(TARGET ccls PROPERTY CXX_EXTENSIONS OFF)
endif() endif()
# To link against LLVM libraries (usually compiled with -fno-rtti) if(NOT LLVM_ENABLE_RTTI)
# releases.llvm.org libraries are compiled with -fno-rtti
# The mismatch between lib{clang,LLVM}* and ccls can make libstdc++ std::make_shared return nullptr
# _Sp_counted_ptr_inplace::_M_get_deleter
target_compile_options(ccls PRIVATE -fno-rtti) target_compile_options(ccls PRIVATE -fno-rtti)
endif()
# CMake sets MSVC for both MSVC and Clang(Windows) # CMake sets MSVC for both MSVC and Clang(Windows)
if(MSVC) if(MSVC)

Loading…
Cancel
Save