-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-include-cleaner] Export public headers as part of the CMake target #167110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@llvm/pr-subscribers-clang-tidy @llvm/pr-subscribers-clangd Author: Victor Chernyakin (localspook) ChangesSo that tools that use include-cleaner, like clangd and clang-tidy, don't need to do ugly manual header management. Full diff: https://github.com/llvm/llvm-project/pull/167110.diff 5 Files Affected:
diff --git a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
index 2cfee5fd10713..26aebf845258b 100644
--- a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
@@ -7,8 +7,6 @@ setup_host_tool(clang-tidy-confusable-chars-gen CLANG_TIDY_CONFUSABLE_CHARS_GEN
add_subdirectory(ConfusableTable)
-include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/../../include-cleaner/include")
-
add_custom_command(
OUTPUT Confusables.inc
COMMAND ${clang_tidy_confusable_chars_gen} ${CMAKE_CURRENT_SOURCE_DIR}/ConfusableTable/confusables.txt ${CMAKE_CURRENT_BINARY_DIR}/Confusables.inc
diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt
index fb3f05329be21..ce816560da6d0 100644
--- a/clang-tools-extra/clangd/CMakeLists.txt
+++ b/clang-tools-extra/clangd/CMakeLists.txt
@@ -59,7 +59,6 @@ if(MSVC AND NOT CLANG_CL)
endif()
include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/../clang-tidy")
-include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/../include-cleaner/include")
add_clang_library(clangDaemon STATIC
AST.cpp
diff --git a/clang-tools-extra/include-cleaner/CMakeLists.txt b/clang-tools-extra/include-cleaner/CMakeLists.txt
index dc147f9ca08df..1b7015f54bdf1 100644
--- a/clang-tools-extra/include-cleaner/CMakeLists.txt
+++ b/clang-tools-extra/include-cleaner/CMakeLists.txt
@@ -1,4 +1,3 @@
-include_directories(include)
add_subdirectory(lib)
add_subdirectory(tool)
if(CLANG_INCLUDE_TESTS)
diff --git a/clang-tools-extra/include-cleaner/lib/CMakeLists.txt b/clang-tools-extra/include-cleaner/lib/CMakeLists.txt
index 7ad5325f6026d..52c8c1789001a 100644
--- a/clang-tools-extra/include-cleaner/lib/CMakeLists.txt
+++ b/clang-tools-extra/include-cleaner/lib/CMakeLists.txt
@@ -14,6 +14,8 @@ add_clang_library(clangIncludeCleaner STATIC
ClangDriverOptions
)
+target_include_directories(clangIncludeCleaner PUBLIC ../include)
+
clang_target_link_libraries(clangIncludeCleaner
PRIVATE
clangAST
diff --git a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
index 64bf47e61736c..69f410404ea62 100644
--- a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
@@ -15,7 +15,6 @@ endif()
get_filename_component(CLANG_LINT_SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/../../clang-tidy REALPATH)
include_directories(${CLANG_LINT_SOURCE_DIR})
-include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/../../include-cleaner/include")
add_extra_unittest(ClangTidyTests
AddConstTest.cpp
|
9f06ba0 to
da8121e
Compare
| @@ -34,6 +34,7 @@ add_clang_library(clangDaemonTweaks OBJECT | |||
| SwapIfBranches.cpp | |||
|
|
|||
| LINK_LIBS | |||
| clangIncludeCleaner | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the should be alphabetical
(same with other places)
So that tools that use include-cleaner, like clangd and clang-tidy, don't need to do ugly manual header management.