[llvm] 2e4ec3e - unittests: Fix build with LLVM_LINK_LLVM_DYLIB=ON

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 06:51:14 PDT 2021


Author: Tom Stellard
Date: 2021-07-07T06:50:45-07:00
New Revision: 2e4ec3e5d6a3bf7f61bea6898286cba64be7b764

URL: https://github.com/llvm/llvm-project/commit/2e4ec3e5d6a3bf7f61bea6898286cba64be7b764
DIFF: https://github.com/llvm/llvm-project/commit/2e4ec3e5d6a3bf7f61bea6898286cba64be7b764.diff

LOG: unittests: Fix build with LLVM_LINK_LLVM_DYLIB=ON

The build system was linking the PluginsTests unittest against libLLVM.so
and LLVMAsmParser which was causing the test to fail with this error:

LLVM ERROR: inconsistency in registered CommandLine options

We need to add llvm libraries to LLVM_LINK_COMPONENTS so that
they are dropped from the linker arguments when linking with
LLVM_LINK_LLVM_DYLIB=ON

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D105523

Added: 
    

Modified: 
    llvm/unittests/Passes/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Passes/CMakeLists.txt b/llvm/unittests/Passes/CMakeLists.txt
index 7c09053c7ab16..37b1d429d053a 100644
--- a/llvm/unittests/Passes/CMakeLists.txt
+++ b/llvm/unittests/Passes/CMakeLists.txt
@@ -12,12 +12,12 @@ endif()
 # work with DLLs on Windows (where a shared library can't have undefined
 # references), so just skip this testcase on Windows.
 if (NOT WIN32)
-  set(LLVM_LINK_COMPONENTS Support Passes Core)
+  set(LLVM_LINK_COMPONENTS Support Passes Core LLVMAsmParser)
   add_llvm_unittest(PluginsTests
     PluginsTest.cpp
     )
   export_executable_symbols_for_plugins(PluginsTests)
-  target_link_libraries(PluginsTests PRIVATE LLVMAsmParser LLVMTestingSupport)
+  target_link_libraries(PluginsTests PRIVATE LLVMTestingSupport)
 
   set(LLVM_LINK_COMPONENTS)
   foreach(PLUGIN TestPlugin DoublerPlugin)


        


More information about the llvm-commits mailing list