Make sure libLLVM users link with libatomic if needed

64-bit atomics are used in llvm/ADT/Statistic.h, which means that users
of libLLVM.so might also have to link with libatomic. To avoid having
to special-case the library here, we simply add all `LLVM_SYSTEM_LIBS`
as public link dependencies to libLLVM.

This fixes a build failure on PowerPC 32-bit.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D132799
This commit is contained in:
Aaron Puchert 2022-09-18 19:11:54 +02:00
parent d3b95ecc98
commit 1a14436c35
1 changed files with 4 additions and 0 deletions

View File

@ -63,6 +63,10 @@ if(LLVM_BUILD_LLVM_DYLIB)
target_link_libraries(LLVM PRIVATE ${LIB_NAMES})
if(LLVM_ENABLE_THREADS AND NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
target_link_libraries(LLVM PUBLIC atomic)
endif()
if (APPLE)
set_property(TARGET LLVM APPEND_STRING PROPERTY
LINK_FLAGS