[clang-tools-extra] [clang-tools-extra] Fix add_clang_library usage (PR #109321)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 12:31:07 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangd

Author: Thomas Fransham (fsfod)

<details>
<summary>Changes</summary>

If a add_clang_library call doesn't specify building as static or shared library they are implicitly added to the list static libraries that is linked in to clang-cpp shared library here.
https://github.com/llvm/llvm-project/blob/315ba7740663208f8bc45a7e4f145dc1df79500c/clang/cmake/modules/AddClang.cmake#L107
Because the clang-tools-extra libraries targets were declared after clang-cpp they by luck never got linked to clang-cpp.
This change is required for clang symbol visibility macros on windows to work correctly for clang tools since we need to distinguish if a target being built will be importing or exporting clang symbols from the clang-cpp DLL.

---

Patch is 24.51 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/109321.diff


49 Files Affected:

- (modified) clang-tools-extra/clang-apply-replacements/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-change-namespace/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-doc/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-include-fixer/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-include-fixer/find-all-symbols/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-include-fixer/plugin/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-move/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-query/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-reorder-fields/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/abseil/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/altera/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/android/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/boost/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/cert/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/concurrency/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/darwin/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/fuchsia/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/google/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/linuxkernel/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/llvm/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/llvmlibc/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/misc/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/modernize/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/mpi/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/objc/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/openmp/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/performance/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/plugin/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/portability/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/readability/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/tool/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/utils/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/zircon/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clangd/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clangd/index/remote/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clangd/support/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clangd/tool/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clangd/xpc/CMakeLists.txt (+2-2) 
- (modified) clang-tools-extra/include-cleaner/lib/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/pseudo/lib/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/pseudo/lib/cli/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/pseudo/lib/cxx/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/pseudo/lib/grammar/CMakeLists.txt (+1-1) 


``````````diff
diff --git a/clang-tools-extra/clang-apply-replacements/CMakeLists.txt b/clang-tools-extra/clang-apply-replacements/CMakeLists.txt
index 93198ccbfc406f..551ded903e88a6 100644
--- a/clang-tools-extra/clang-apply-replacements/CMakeLists.txt
+++ b/clang-tools-extra/clang-apply-replacements/CMakeLists.txt
@@ -2,7 +2,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangApplyReplacements
+add_clang_library(clangApplyReplacements STATIC
   lib/Tooling/ApplyReplacements.cpp
 
   DEPENDS
diff --git a/clang-tools-extra/clang-change-namespace/CMakeLists.txt b/clang-tools-extra/clang-change-namespace/CMakeLists.txt
index ded91edb8e34f0..62289ad031cfd6 100644
--- a/clang-tools-extra/clang-change-namespace/CMakeLists.txt
+++ b/clang-tools-extra/clang-change-namespace/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangChangeNamespace
+add_clang_library(clangChangeNamespace STATIC
   ChangeNamespace.cpp
 
   DEPENDS
diff --git a/clang-tools-extra/clang-doc/CMakeLists.txt b/clang-tools-extra/clang-doc/CMakeLists.txt
index 975ad8e242e490..520fe58cbe68e8 100644
--- a/clang-tools-extra/clang-doc/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/CMakeLists.txt
@@ -4,7 +4,7 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-add_clang_library(clangDoc
+add_clang_library(clangDoc STATIC
   BitcodeReader.cpp
   BitcodeWriter.cpp
   ClangDoc.cpp
diff --git a/clang-tools-extra/clang-include-fixer/CMakeLists.txt b/clang-tools-extra/clang-include-fixer/CMakeLists.txt
index 94afdcc3c67b6e..00f2f6976152cc 100644
--- a/clang-tools-extra/clang-include-fixer/CMakeLists.txt
+++ b/clang-tools-extra/clang-include-fixer/CMakeLists.txt
@@ -2,7 +2,7 @@ set(LLVM_LINK_COMPONENTS
   support
   )
 
-add_clang_library(clangIncludeFixer
+add_clang_library(clangIncludeFixer STATIC
   IncludeFixer.cpp
   IncludeFixerContext.cpp
   InMemorySymbolIndex.cpp
diff --git a/clang-tools-extra/clang-include-fixer/find-all-symbols/CMakeLists.txt b/clang-tools-extra/clang-include-fixer/find-all-symbols/CMakeLists.txt
index 0ed46428b0d63d..ad4eccfb377ecd 100644
--- a/clang-tools-extra/clang-include-fixer/find-all-symbols/CMakeLists.txt
+++ b/clang-tools-extra/clang-include-fixer/find-all-symbols/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-add_clang_library(findAllSymbols
+add_clang_library(findAllSymbols STATIC
   FindAllSymbols.cpp
   FindAllSymbolsAction.cpp
   FindAllMacros.cpp
diff --git a/clang-tools-extra/clang-include-fixer/plugin/CMakeLists.txt b/clang-tools-extra/clang-include-fixer/plugin/CMakeLists.txt
index db5d5a8324389d..b193a30ad4e119 100644
--- a/clang-tools-extra/clang-include-fixer/plugin/CMakeLists.txt
+++ b/clang-tools-extra/clang-include-fixer/plugin/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_clang_library(clangIncludeFixerPlugin
+add_clang_library(clangIncludeFixerPlugin STATIC
   IncludeFixerPlugin.cpp
 
   LINK_LIBS
diff --git a/clang-tools-extra/clang-move/CMakeLists.txt b/clang-tools-extra/clang-move/CMakeLists.txt
index e8aeaedd61d4dd..1380a111c5c4cb 100644
--- a/clang-tools-extra/clang-move/CMakeLists.txt
+++ b/clang-tools-extra/clang-move/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-add_clang_library(clangMove
+add_clang_library(clangMove STATIC
   Move.cpp
   HelperDeclRefGraph.cpp
 
diff --git a/clang-tools-extra/clang-query/CMakeLists.txt b/clang-tools-extra/clang-query/CMakeLists.txt
index 34f018c4a03f38..b168a3a8581567 100644
--- a/clang-tools-extra/clang-query/CMakeLists.txt
+++ b/clang-tools-extra/clang-query/CMakeLists.txt
@@ -4,7 +4,7 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-add_clang_library(clangQuery
+add_clang_library(clangQuery STATIC
   Query.cpp
   QueryParser.cpp
 
diff --git a/clang-tools-extra/clang-reorder-fields/CMakeLists.txt b/clang-tools-extra/clang-reorder-fields/CMakeLists.txt
index b82146a7115858..2fdeb65d89767b 100644
--- a/clang-tools-extra/clang-reorder-fields/CMakeLists.txt
+++ b/clang-tools-extra/clang-reorder-fields/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   support
 )
 
-add_clang_library(clangReorderFields
+add_clang_library(clangReorderFields STATIC
   ReorderFieldsAction.cpp
 
   DEPENDS
diff --git a/clang-tools-extra/clang-tidy/CMakeLists.txt b/clang-tools-extra/clang-tidy/CMakeLists.txt
index 430ea4cdbb38e1..83a3236131dc93 100644
--- a/clang-tools-extra/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -8,7 +8,7 @@ configure_file(
   ${CMAKE_CURRENT_BINARY_DIR}/clang-tidy-config.h)
 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
 
-add_clang_library(clangTidy
+add_clang_library(clangTidy STATIC
   ClangTidy.cpp
   ClangTidyCheck.cpp
   ClangTidyModule.cpp
diff --git a/clang-tools-extra/clang-tidy/abseil/CMakeLists.txt b/clang-tools-extra/clang-tidy/abseil/CMakeLists.txt
index 489d732abaa8de..ca7cc6782f1e6d 100644
--- a/clang-tools-extra/clang-tidy/abseil/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/abseil/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-add_clang_library(clangTidyAbseilModule
+add_clang_library(clangTidyAbseilModule STATIC
   AbseilTidyModule.cpp
   CleanupCtadCheck.cpp
   DurationAdditionCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/altera/CMakeLists.txt b/clang-tools-extra/clang-tidy/altera/CMakeLists.txt
index f885993c3c9e71..5d9e7b3a023bb1 100644
--- a/clang-tools-extra/clang-tidy/altera/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/altera/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   support
   )
 
-add_clang_library(clangTidyAlteraModule
+add_clang_library(clangTidyAlteraModule STATIC
   AlteraTidyModule.cpp
   IdDependentBackwardBranchCheck.cpp
   KernelNameRestrictionCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/android/CMakeLists.txt b/clang-tools-extra/clang-tidy/android/CMakeLists.txt
index c33d0daf4e25c0..b461730ef14188 100644
--- a/clang-tools-extra/clang-tidy/android/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/android/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-add_clang_library(clangTidyAndroidModule
+add_clang_library(clangTidyAndroidModule STATIC
   AndroidTidyModule.cpp
   CloexecAccept4Check.cpp
   CloexecAcceptCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/boost/CMakeLists.txt b/clang-tools-extra/clang-tidy/boost/CMakeLists.txt
index fed3c3ba01c169..9032771ec2fdcc 100644
--- a/clang-tools-extra/clang-tidy/boost/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/boost/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-add_clang_library(clangTidyBoostModule
+add_clang_library(clangTidyBoostModule STATIC
   BoostTidyModule.cpp
   UseRangesCheck.cpp
   UseToStringCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
index cb0d8ae98bac58..366d547599a105 100644
--- a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-add_clang_library(clangTidyBugproneModule
+add_clang_library(clangTidyBugproneModule STATIC
   ArgumentCommentCheck.cpp
   AssertSideEffectCheck.cpp
   AssignmentInIfConditionCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/cert/CMakeLists.txt b/clang-tools-extra/clang-tidy/cert/CMakeLists.txt
index 882735c9d1e0de..e3187b28399c70 100644
--- a/clang-tools-extra/clang-tidy/cert/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/cert/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-add_clang_library(clangTidyCERTModule
+add_clang_library(clangTidyCERTModule STATIC
   CERTTidyModule.cpp
   CommandProcessorCheck.cpp
   DefaultOperatorNewAlignmentCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/concurrency/CMakeLists.txt b/clang-tools-extra/clang-tidy/concurrency/CMakeLists.txt
index 3dab6aaf8aea27..91c6cedabcc807 100644
--- a/clang-tools-extra/clang-tidy/concurrency/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/concurrency/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyConcurrencyModule
+add_clang_library(clangTidyConcurrencyModule STATIC
   ConcurrencyTidyModule.cpp
   MtUnsafeCheck.cpp
   ThreadCanceltypeAsynchronousCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt b/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt
index eb35bbc6a538fe..07bb89ec7937a0 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyCppCoreGuidelinesModule
+add_clang_library(clangTidyCppCoreGuidelinesModule STATIC
   AvoidCapturingLambdaCoroutinesCheck.cpp
   AvoidConstOrRefDataMembersCheck.cpp
   AvoidDoWhileCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/darwin/CMakeLists.txt b/clang-tools-extra/clang-tidy/darwin/CMakeLists.txt
index 6f6b3607b3ec64..d19e8144bcfa3e 100644
--- a/clang-tools-extra/clang-tidy/darwin/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/darwin/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyDarwinModule
+add_clang_library(clangTidyDarwinModule STATIC
   AvoidSpinlockCheck.cpp
   DarwinTidyModule.cpp
   DispatchOnceNonstaticCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/fuchsia/CMakeLists.txt b/clang-tools-extra/clang-tidy/fuchsia/CMakeLists.txt
index d0e68bfec47fec..c12c281bc53211 100644
--- a/clang-tools-extra/clang-tidy/fuchsia/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/fuchsia/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyFuchsiaModule
+add_clang_library(clangTidyFuchsiaModule STATIC
   DefaultArgumentsCallsCheck.cpp
   DefaultArgumentsDeclarationsCheck.cpp
   FuchsiaTidyModule.cpp
diff --git a/clang-tools-extra/clang-tidy/google/CMakeLists.txt b/clang-tools-extra/clang-tidy/google/CMakeLists.txt
index fcba2b1b214adc..2470c089ef7ca3 100644
--- a/clang-tools-extra/clang-tidy/google/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/google/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyGoogleModule
+add_clang_library(clangTidyGoogleModule STATIC
   AvoidCStyleCastsCheck.cpp
   AvoidNSObjectNewCheck.cpp
   AvoidThrowingObjCExceptionCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt b/clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt
index 132fbaccccf8a9..2f31d168e65c0c 100644
--- a/clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/hicpp/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyHICPPModule
+add_clang_library(clangTidyHICPPModule STATIC
   ExceptionBaseclassCheck.cpp
   HICPPTidyModule.cpp
   IgnoredRemoveResultCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/linuxkernel/CMakeLists.txt b/clang-tools-extra/clang-tidy/linuxkernel/CMakeLists.txt
index 403589d9475904..e7e2dcf9a82fe1 100644
--- a/clang-tools-extra/clang-tidy/linuxkernel/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/linuxkernel/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyLinuxKernelModule
+add_clang_library(clangTidyLinuxKernelModule STATIC
   LinuxKernelTidyModule.cpp
   MustCheckErrsCheck.cpp
 
diff --git a/clang-tools-extra/clang-tidy/llvm/CMakeLists.txt b/clang-tools-extra/clang-tidy/llvm/CMakeLists.txt
index b56498bdc8c4b2..79c58a19aedac6 100644
--- a/clang-tools-extra/clang-tidy/llvm/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/llvm/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyLLVMModule
+add_clang_library(clangTidyLLVMModule STATIC
   HeaderGuardCheck.cpp
   IncludeOrderCheck.cpp
   LLVMTidyModule.cpp
diff --git a/clang-tools-extra/clang-tidy/llvmlibc/CMakeLists.txt b/clang-tools-extra/clang-tidy/llvmlibc/CMakeLists.txt
index b071cfd67dcf42..eaeddf4f628573 100644
--- a/clang-tools-extra/clang-tidy/llvmlibc/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/llvmlibc/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyLLVMLibcModule
+add_clang_library(clangTidyLLVMLibcModule STATIC
   CalleeNamespaceCheck.cpp
   ImplementationInNamespaceCheck.cpp
   InlineFunctionDeclCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
index 1c1d3b836ea1b8..fd7affd22a463e 100644
--- a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
@@ -17,7 +17,7 @@ add_custom_command(
 add_custom_target(genconfusable DEPENDS Confusables.inc)
 set_target_properties(genconfusable PROPERTIES FOLDER "Clang Tools Extra/Sourcegenning")
 
-add_clang_library(clangTidyMiscModule
+add_clang_library(clangTidyMiscModule STATIC
   ConstCorrectnessCheck.cpp
   CoroutineHostileRAIICheck.cpp
   DefinitionsInHeadersCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
index 4f68c487cac9d4..c919d49b42873a 100644
--- a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyModernizeModule
+add_clang_library(clangTidyModernizeModule STATIC
   AvoidBindCheck.cpp
   AvoidCArraysCheck.cpp
   ConcatNestedNamespacesCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/mpi/CMakeLists.txt b/clang-tools-extra/clang-tidy/mpi/CMakeLists.txt
index 717683042f5247..1232a28c7cf7be 100644
--- a/clang-tools-extra/clang-tidy/mpi/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/mpi/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyMPIModule
+add_clang_library(clangTidyMPIModule STATIC
   BufferDerefCheck.cpp
   MPITidyModule.cpp
   TypeMismatchCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/objc/CMakeLists.txt b/clang-tools-extra/clang-tidy/objc/CMakeLists.txt
index aa428fce56a599..e28d25deee84c1 100644
--- a/clang-tools-extra/clang-tidy/objc/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/objc/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyObjCModule
+add_clang_library(clangTidyObjCModule STATIC
   AssertEquals.cpp
   AvoidNSErrorInitCheck.cpp
   DeallocInCategoryCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/openmp/CMakeLists.txt b/clang-tools-extra/clang-tidy/openmp/CMakeLists.txt
index 4ef61f88c05097..acee08a48aeff3 100644
--- a/clang-tools-extra/clang-tidy/openmp/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/openmp/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyOpenMPModule
+add_clang_library(clangTidyOpenMPModule STATIC
   ExceptionEscapeCheck.cpp
   OpenMPTidyModule.cpp
   UseDefaultNoneCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/performance/CMakeLists.txt b/clang-tools-extra/clang-tidy/performance/CMakeLists.txt
index 81128ff086021e..c6e547c5089fb0 100644
--- a/clang-tools-extra/clang-tidy/performance/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/performance/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyPerformanceModule
+add_clang_library(clangTidyPerformanceModule STATIC
   AvoidEndlCheck.cpp
   EnumSizeCheck.cpp
   FasterStringFindCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/plugin/CMakeLists.txt b/clang-tools-extra/clang-tidy/plugin/CMakeLists.txt
index 673da472a74680..aff2018b693b10 100644
--- a/clang-tools-extra/clang-tidy/plugin/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/plugin/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_clang_library(clangTidyPlugin
+add_clang_library(clangTidyPlugin STATIC
   ClangTidyPlugin.cpp
 
   LINK_LIBS
diff --git a/clang-tools-extra/clang-tidy/portability/CMakeLists.txt b/clang-tools-extra/clang-tidy/portability/CMakeLists.txt
index 01a86d686daa76..3f0b7d47207938 100644
--- a/clang-tools-extra/clang-tidy/portability/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/portability/CMakeLists.txt
@@ -4,7 +4,7 @@ set(LLVM_LINK_COMPONENTS
   TargetParser
   )
 
-add_clang_library(clangTidyPortabilityModule
+add_clang_library(clangTidyPortabilityModule STATIC
   PortabilityTidyModule.cpp
   RestrictSystemIncludesCheck.cpp
   SIMDIntrinsicsCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
index 41065fc8e87859..8f303c51e1b0da 100644
--- a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyReadabilityModule
+add_clang_library(clangTidyReadabilityModule STATIC
   AvoidConstParamsInDecls.cpp
   AvoidNestedConditionalOperatorCheck.cpp
   AvoidReturnWithVoidValueCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
index b220cbea80f1b6..81fba3bbf12fe4 100644
--- a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -9,7 +9,7 @@ set(LLVM_LINK_COMPONENTS
 # Needed by LLVM's CMake checks because this file defines multiple targets.
 set(LLVM_OPTIONAL_SOURCES ClangTidyMain.cpp ClangTidyToolMain.cpp)
 
-add_clang_library(clangTidyMain
+add_clang_library(clangTidyMain STATIC
   ClangTidyMain.cpp
 
   LINK_LIBS
diff --git a/clang-tools-extra/clang-tidy/utils/CMakeLists.txt b/clang-tools-extra/clang-tidy/utils/CMakeLists.txt
index 504c6e928bdad0..b83a1e9a77182b 100644
--- a/clang-tools-extra/clang-tidy/utils/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/utils/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyUtils
+add_clang_library(clangTidyUtils STATIC
   Aliasing.cpp
   ASTUtils.cpp
   BracesAroundStatement.cpp
diff --git a/clang-tools-extra/clang-tidy/zircon/CMakeLists.txt b/clang-tools-extra/clang-tidy/zircon/CMakeLists.txt
index cd605d6d6c108d..e08fe80e730ac5 100644
--- a/clang-tools-extra/clang-tidy/zircon/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/zircon/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_library(clangTidyZirconModule
+add_clang_library(clangTidyZirconModule STATIC
   TemporaryObjectsCheck.cpp
   ZirconTidyModule.cpp
 
diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt
index c21d277d2ffcbd..99d5c90b022e26 100644
--- a/clang-tools-extra/clangd/CMakeLists.txt
+++ b/clang-tools-extra/clangd/CMakeLists.txt
@@ -61,7 +61,7 @@ endif()
 include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/../clang-tidy")
 include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/../include-cleaner/include")
 
-add_clang_library(clangDaemon
+add_clang_library(clangDaemon STATIC
   AST.cpp
   ASTSignals.cpp
   ClangdLSPServer.cpp
diff --git a/clang-tools-extra/clangd/index/remote/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
index 106bbeff84ccf3..28df71855a1421 100644
--- a/clang-tools-extra/clangd/index/remote/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
@@ -19,7 +19,7 @@ if (CLANGD_ENABLE_REMOTE)
   # target-local?
   add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)
 
-  add_clang_library(clangdRemoteIndex
+  add_clang_library(clangdRemoteIndex STATIC
     Client.cpp
 
     LINK_LIBS
diff --git a/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
index 071802a9626471..d7e37003e5f984 100644
--- a/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_clang_library(clangdRemoteMarshalling
+add_clang_library(clangdRemoteMarshalling STATIC
   Marshalling.cpp
 
   LINK_LIBS
diff --git a/clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt
index 86d13c77ce8746..5c4907f0d7a832 100644
--- a/clang-tools-extra/clangd/i...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/109321


More information about the cfe-commits mailing list