Skip to content

Commit f3d77cf

Browse files
khueyAlexisPerry
authored andcommitted
[llvm-config] Make llvm-config --system-libs obey LLVM_USE_STATIC_ZSTD (llvm#93754)
LLVM's build system does the right thing but LLVM_SYSTEM_LIBS ends up containing the shared library. Emit the static library instead when appropriate. With LLVM_USE_STATIC_ZSTD, before: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz -lzstd -lxml2 after: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz /usr/local/lib/libzstd.a -lxml2
1 parent ef20d5b commit f3d77cf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: llvm/lib/Support/CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,12 @@ if(LLVM_ENABLE_ZSTD)
323323
if(NOT zstd_library)
324324
get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION)
325325
endif()
326-
get_library_name(${zstd_library} zstd_library)
327-
set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
326+
if (zstd_target STREQUAL zstd::libzstd_shared)
327+
get_library_name(${zstd_library} zstd_library)
328+
set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
329+
else()
330+
set(llvm_system_libs ${llvm_system_libs} "${zstd_STATIC_LIBRARY}")
331+
endif()
328332
endif()
329333

330334
set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${llvm_system_libs}")

0 commit comments

Comments
 (0)