Skip to content

Commit

Permalink
unittests: Fix build with LLVM_LINK_LLVM_DYLIB=ON
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tstellar committed Jul 7, 2021
1 parent feef171 commit 2e4ec3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/unittests/Passes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2e4ec3e

Please sign in to comment.