Skip to content

Commit 8e6d526

Browse files
committed
Remove LLVMSupport through properties of ClangReplInterpreterTests instead of AddLLVM.cmake modification
1 parent 57e2e09 commit 8e6d526

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

clang/unittests/Interpreter/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ add_distinct_clang_unittest(ClangReplInterpreterTests
4949
)
5050

5151
if(EMSCRIPTEN)
52+
# Without the above you try to link to LLVMSupport twice, and end
53+
# up with a duplicate symbol error when creating the main module
54+
get_target_property(LINKED_LIBS ClangReplInterpreterTests LINK_LIBRARIES)
55+
list(REMOVE_ITEM LINKED_LIBS LLVMSupport)
56+
set_target_properties(ClangReplInterpreterTests PROPERTIES LINK_LIBRARIES "${LINKED_LIBS}")
5257
target_link_options(ClangReplInterpreterTests
5358
PUBLIC "SHELL: -s MAIN_MODULE=1"
5459
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,9 +1764,7 @@ function(add_unittest test_suite test_name)
17641764
set(LLVM_REQUIRES_RTTI OFF)
17651765
endif()
17661766
1767-
if(NOT EMSCRIPTEN)
1768-
list(APPEND LLVM_LINK_COMPONENTS Support) # gtest needs it for raw_ostream
1769-
endif()
1767+
list(APPEND LLVM_LINK_COMPONENTS Support) # gtest needs it for raw_ostream
17701768
add_llvm_executable(${test_name} IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH ${ARGN})
17711769
get_subproject_title(subproject_title)
17721770
set_target_properties(${test_name} PROPERTIES FOLDER "${subproject_title}/Tests/Unit")

0 commit comments

Comments
 (0)