Skip to content

Commit 39d3b47

Browse files
authored
Merge pull request #2291 from jschueller/llvm
CMake: support LLVM as a single shared library
2 parents dff5798 + c5c5046 commit 39d3b47

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,17 @@ if (WITH_LLVM)
157157
add_definitions("-DHAVE_TARGET_X86=1")
158158
endif()
159159

160-
llvm_map_components_to_libnames(llvm_libs ${LPYTHON_LLVM_COMPONENTS})
160+
if (TARGET LLVMCore)
161+
# If `LLVMCore` target is present, then LLVM is distributed as separate
162+
# libraries and llvm_map_components_to_libnames() should work:
163+
llvm_map_components_to_libnames(llvm_libs ${LPYTHON_LLVM_COMPONENTS})
164+
else()
165+
# Workaround for https://github.com/llvm/llvm-project/issues/34593
166+
# If LLVM is distributed as a single library (the LLVMCore target is
167+
# missing), we set `llvm_libs` to "LLVM" which links against the single
168+
# `libLLVM.so` shared library.
169+
set(llvm_libs "LLVM")
170+
endif()
161171
unset(LPYTHON_LLVM_COMPONENTS)
162172

163173
add_library(p::llvm INTERFACE IMPORTED)

0 commit comments

Comments
 (0)