[PATCH] D114505: [clang][unittests]Fix a clang unittest linking issue

Lu Weining via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 23 23:48:22 PST 2021


SixWeining created this revision.
SixWeining added reviewers: cfe-commits, dexonsmith.
Herald added a subscriber: mgorny.
SixWeining requested review of this revision.
Herald added a project: clang.

Currently the clang/unittests/Basic/CMakeLists.txt links LLVMTestingSupport in an incorrect way that would cause `ninja check-clang` failing with a linking error like below:
/usr/bin/ld: tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileManagerTest.cpp.o: in function `(anonymous namespace)::FileManagerTest_getBypassFile_Test::TestBody()':
FileManagerTest.cpp:(.text._ZN12_GLOBAL__N_134FileManagerTest_getBypassFile_Test8TestBodyEv+0x3a3): undefined reference to `llvm::detail::TakeError(llvm::Error)'

This patch changes the linking method of LLVMTestingSupport from clang_target_link_libraries to target_link_libraries just like other tests do.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114505

Files:
  clang/unittests/Basic/CMakeLists.txt


Index: clang/unittests/Basic/CMakeLists.txt
===================================================================
--- clang/unittests/Basic/CMakeLists.txt
+++ clang/unittests/Basic/CMakeLists.txt
@@ -18,5 +18,9 @@
   clangAST
   clangBasic
   clangLex
-  LLVMTestingSupport
   )
+
+target_link_libraries(BasicTests
+  PRIVATE
+  LLVMTestingSupport
+)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114505.389399.patch
Type: text/x-patch
Size: 349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211124/c21004c6/attachment.bin>


More information about the cfe-commits mailing list