@@ -5,13 +5,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
55include (DefaultCMakeBuildType )
66
77# Required Clang version
8- set (CLANG_DOWNLOAD_LOCATION ${CMAKE_BINARY_DIR}
9- CACHE STRING "Downloaded Clang location" )
10- option (SYSTEM_CLANG "Use system installation of Clang instead of \
11- downloading Clang" OFF )
12- option (ASAN "Compile with address sanitizers" OFF )
138option (LLVM_ENABLE_RTTI "-fno-rtti if OFF. This should match LLVM libraries" OFF )
14- option (CLANG_USE_BUNDLED_LIBC++ "Let Clang use bundled libc++" OFF )
159option (USE_SHARED_LLVM "Link against libLLVM.so instead separate LLVM{Option,Support,...}" OFF )
1610
1711# Sources for the executable are specified at end of CMakeLists.txt
@@ -30,10 +24,7 @@ add_executable(ccls "")
3024# Enable C++17 (Required)
3125set_property (TARGET ccls PROPERTY CXX_STANDARD 17 )
3226set_property (TARGET ccls PROPERTY CXX_STANDARD_REQUIRED ON )
33- # Disable gnu extensions except for Cygwin which needs them to build properly
34- if (NOT CYGWIN )
35- set_property (TARGET ccls PROPERTY CXX_EXTENSIONS OFF )
36- endif ()
27+ set_property (TARGET ccls PROPERTY CXX_EXTENSIONS OFF )
3728
3829if (NOT LLVM_ENABLE_RTTI)
3930 # releases.llvm.org libraries are compiled with -fno-rtti
@@ -76,37 +67,6 @@ else()
7667 target_compile_options (ccls PRIVATE
7768 $<$<CONFIG :Debug >:-fno -limit -debug -info >)
7869 endif ()
79-
80- if (ASAN)
81- target_compile_options (ccls PRIVATE -fsanitize=address,undefined )
82- # target_link_libraries also takes linker flags
83- target_link_libraries (ccls PRIVATE -fsanitize=address,undefined )
84- endif ()
85- endif ()
86-
87- ### Download Clang if required
88-
89- if (NOT SYSTEM_CLANG)
90- message (STATUS "Using downloaded Clang" )
91-
92- include (DownloadAndExtractClang )
93- download_and_extract_clang (${CLANG_DOWNLOAD_LOCATION} )
94- # Used by FindClang
95- set (CLANG_ROOT ${DOWNLOADED_CLANG_DIR} )
96-
97- if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang AND CLANG_USE_BUNDLED_LIBC++)
98- message (STATUS "Using bundled libc++" )
99- target_compile_options (ccls PRIVATE -nostdinc++ -cxx-isystem ${CLANG_ROOT} /include/c++/v1 )
100- if (${CMAKE_SYSTEM_NAME} STREQUAL Linux )
101- # Don't use -stdlib=libc++ because while ccls is linked with libc++, bundled clang+llvm require libstdc++
102- target_link_libraries (ccls PRIVATE -L${CLANG_ROOT}/lib c++ c++abi )
103-
104- # FreeBSD defaults to -stdlib=libc++ and uses system libcxxrt.a
105- endif ()
106- endif ()
107-
108- else ()
109- message (STATUS "Using system Clang" )
11070endif ()
11171
11272### Libraries
@@ -143,31 +103,6 @@ target_include_directories(ccls SYSTEM PRIVATE
143103
144104install (TARGETS ccls RUNTIME DESTINATION bin)
145105
146- if (NOT SYSTEM_CLANG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL Windows)
147-
148- if (${CMAKE_SYSTEM_NAME} MATCHES Linux |FreeBSD)
149- set_property (TARGET ccls APPEND PROPERTY
150- INSTALL_RPATH $ORIGIN/../lib )
151- elseif (${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
152- set_property (TARGET ccls APPEND PROPERTY
153- INSTALL_RPATH @loader_path/../lib )
154- endif ()
155-
156- file (GLOB LIBCLANG_PLUS_SYMLINKS
157- ${DOWNLOADED_CLANG_DIR} /lib/libclang.[so,dylib]* )
158- install (FILES ${LIBCLANG_PLUS_SYMLINKS} DESTINATION lib)
159- endif ()
160-
161- # Allow running from build Windows by copying libclang.dll to build directory
162- if (NOT SYSTEM_CLANG AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows)
163- add_custom_command (TARGET ccls
164- POST_BUILD
165- COMMAND ${CMAKE_COMMAND} -E copy
166- ${DOWNLOADED_CLANG_DIR} /bin/libclang.dll
167- $<TARGET_FILE_DIR :ccls >
168- COMMENT "Copying libclang.dll to build directory ..." )
169- endif ()
170-
171106### Tools
172107
173108# We use glob here since source files are already manually added with
0 commit comments