[clang-tools-extra] 68294af - [include-cleaner] Fix building with LLVM_LINK_LLVM_DYLIB=ON on mingw

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 00:30:38 PST 2022


Author: Martin Storsjö
Date: 2022-11-18T10:30:26+02:00
New Revision: 68294afa0836bb62be921e2143d147cdfdc8ba70

URL: https://github.com/llvm/llvm-project/commit/68294afa0836bb62be921e2143d147cdfdc8ba70
DIFF: https://github.com/llvm/llvm-project/commit/68294afa0836bb62be921e2143d147cdfdc8ba70.diff

LOG: [include-cleaner] Fix building with LLVM_LINK_LLVM_DYLIB=ON on mingw

Make sure to use clang_target_link_libraries, which skips linking
against libraries and links against libclang-cpp instead, if
LLVM_LINK_LLVM_DYLIB is enabled.

This fixes errors like these:

ld.lld: error: duplicate symbol: clang::PPCallbacks::~PPCallbacks()
>>> defined at libclangLex.a(PPCallbacks.cpp.obj)
>>> defined at libclang-cpp.dll

Added: 
    

Modified: 
    clang-tools-extra/include-cleaner/lib/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/include-cleaner/lib/CMakeLists.txt b/clang-tools-extra/include-cleaner/lib/CMakeLists.txt
index 617539ae0dba4..a71276f54b643 100644
--- a/clang-tools-extra/include-cleaner/lib/CMakeLists.txt
+++ b/clang-tools-extra/include-cleaner/lib/CMakeLists.txt
@@ -8,8 +8,10 @@ add_clang_library(clangIncludeCleaner
   Record.cpp
   Types.cpp
   WalkAST.cpp
+  )
 
-  LINK_LIBS
+clang_target_link_libraries(clangIncludeCleaner
+  PRIVATE
   clangAST
   clangBasic
   clangLex


        


More information about the cfe-commits mailing list