Skip to content

Commit 3f5e649

Browse files
authored
[Libomptarget] Fix linking to LLVM dylib (#86397)
Use `LINK_COMPONENTS` parameter of `add_llvm_library` rather than passing LLVM components directly to `target_link_libraries`, in order to ensure that LLVM dylib is linked correctly when used. Otherwise, CMake insists on linking to static libraries that aren't present on distributions doing pure dylib installs, such as Gentoo. This fixes a regression introduced in dcbddc2.
1 parent b68e2eb commit 3f5e649

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

openmp/libomptarget/plugins-nextgen/CMakeLists.txt

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,40 @@
1414
set(common_dir ${CMAKE_CURRENT_SOURCE_DIR}/common)
1515
add_subdirectory(common)
1616
function(add_target_library target_name lib_name)
17-
llvm_map_components_to_libnames(llvm_libs
18-
${LLVM_TARGETS_TO_BUILD}
19-
AggressiveInstCombine
20-
Analysis
21-
BinaryFormat
22-
BitReader
23-
BitWriter
24-
CodeGen
25-
Core
26-
Extensions
27-
InstCombine
28-
Instrumentation
29-
IPO
30-
IRReader
31-
Linker
32-
MC
33-
Object
34-
Passes
35-
Remarks
36-
ScalarOpts
37-
Support
38-
Target
39-
TargetParser
40-
TransformUtils
41-
Vectorize
42-
)
43-
4417
add_llvm_library(${target_name} SHARED
18+
LINK_COMPONENTS
19+
${LLVM_TARGETS_TO_BUILD}
20+
AggressiveInstCombine
21+
Analysis
22+
BinaryFormat
23+
BitReader
24+
BitWriter
25+
CodeGen
26+
Core
27+
Extensions
28+
InstCombine
29+
Instrumentation
30+
IPO
31+
IRReader
32+
Linker
33+
MC
34+
Object
35+
Passes
36+
Remarks
37+
ScalarOpts
38+
Support
39+
Target
40+
TargetParser
41+
TransformUtils
42+
Vectorize
43+
4544
NO_INSTALL_RPATH
4645
BUILDTREE_ONLY
4746
)
4847

4948
llvm_update_compile_flags(${target_name})
5049
target_link_libraries(${target_name} PRIVATE
51-
PluginCommon ${llvm_libs} ${OPENMP_PTHREAD_LIB})
50+
PluginCommon ${OPENMP_PTHREAD_LIB})
5251

5352
target_compile_definitions(${target_name} PRIVATE TARGET_NAME=${lib_name})
5453
target_compile_definitions(${target_name} PRIVATE

0 commit comments

Comments
 (0)