mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 05:46:45 +00:00
[clangd] CMake: express -Iclangd/ at top level and inherit
For files directly under clangd/, -Iclang-tools-extra/clangd (and the equivalent for generated files) are not required, as CMake/the compiler puts these directories on the include path by default. However this means each subdirectory needs to include_directories(.. ${CMAKE_CURRENT_BINARY_DIR}/..) etc, and this proved annoying and error-prone to maintain and debug. Since include_directories is inherited by subdirectories, we just configure this explicitly at the top level instead.
This commit is contained in:
parent
4facbf213c
commit
26e1553a10
@ -1,3 +1,7 @@
|
||||
# This is a no-op for building files in this dir, but is inherited by subdirs.
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_subdirectory(support)
|
||||
|
||||
# Configure the Features.inc file.
|
||||
|
@ -1,6 +1,3 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
|
||||
add_subdirectory(CompletionModel)
|
||||
|
||||
add_benchmark(IndexBenchmark IndexBenchmark.cpp)
|
||||
|
@ -1,5 +1,3 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
|
||||
add_benchmark(DecisionForestBenchmark DecisionForestBenchmark.cpp)
|
||||
|
||||
target_link_libraries(DecisionForestBenchmark
|
||||
|
@ -1,6 +1,3 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
FuzzMutate
|
||||
Support
|
||||
|
@ -1,6 +1,3 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../)
|
||||
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
LineEditor
|
||||
Support
|
||||
|
@ -13,8 +13,6 @@ if (CLANGD_ENABLE_REMOTE)
|
||||
MonitoringServiceProto
|
||||
)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../)
|
||||
|
||||
# FIXME(kirillbobyrev): target_compile_definitions is not working with
|
||||
# add_clang_library for some reason. Is there any way to make this
|
||||
|
@ -1,6 +1,3 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../)
|
||||
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
Support
|
||||
)
|
||||
|
@ -15,7 +15,6 @@ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
|
||||
list(APPEND CLANGD_ATOMIC_LIB "atomic")
|
||||
endif()
|
||||
|
||||
include_directories(..)
|
||||
add_clang_library(clangdSupport
|
||||
Cancellation.cpp
|
||||
Context.cpp
|
||||
|
@ -1,6 +1,3 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
|
||||
add_clang_tool(clangd
|
||||
ClangdMain.cpp
|
||||
Check.cpp
|
||||
|
@ -4,15 +4,6 @@ set(LLVM_LINK_COMPONENTS
|
||||
FrontendOpenMP
|
||||
)
|
||||
|
||||
get_filename_component(CLANGD_SOURCE_DIR
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../clangd REALPATH)
|
||||
get_filename_component(CLANGD_BINARY_DIR
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../clangd REALPATH)
|
||||
include_directories(
|
||||
${CLANGD_SOURCE_DIR}
|
||||
${CLANGD_BINARY_DIR}
|
||||
)
|
||||
|
||||
if(CLANG_BUILT_STANDALONE)
|
||||
# LLVMTestingSupport library is needed for clangd tests.
|
||||
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
|
||||
|
@ -2,15 +2,6 @@ set(LLVM_LINK_COMPONENTS
|
||||
support
|
||||
)
|
||||
|
||||
get_filename_component(CLANGD_SOURCE_DIR
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../clangd REALPATH)
|
||||
get_filename_component(CLANGD_BINARY_DIR
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../clangd REALPATH)
|
||||
include_directories(
|
||||
${CLANGD_SOURCE_DIR}
|
||||
${CLANGD_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(ClangdXpcUnitTests)
|
||||
add_unittest(ClangdXpcUnitTests ClangdXpcTests
|
||||
ConversionTests.cpp
|
||||
|
@ -7,11 +7,6 @@ include(CreateClangdXPCFramework)
|
||||
add_subdirectory(framework)
|
||||
add_subdirectory(test-client)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
)
|
||||
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
Support
|
||||
)
|
||||
|
@ -1,7 +1,3 @@
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
)
|
||||
|
||||
add_clang_tool(
|
||||
clangd-xpc-test-client
|
||||
ClangdXPCTestClient.cpp
|
||||
|
Loading…
x
Reference in New Issue
Block a user