Skip to content

Commit e6a6470

Browse files
khueynikic
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 (cherry-picked from 0f24a46)
1 parent 934954a commit e6a6470

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llvm/lib/Support/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,12 @@ if(LLVM_ENABLE_ZSTD)
318318
if(NOT zstd_library)
319319
get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION)
320320
endif()
321-
get_library_name(${zstd_library} zstd_library)
322-
set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
321+
if (zstd_target STREQUAL zstd::libzstd_shared)
322+
get_library_name(${zstd_library} zstd_library)
323+
set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
324+
else()
325+
set(llvm_system_libs ${llvm_system_libs} "${zstd_STATIC_LIBRARY}")
326+
endif()
323327
endif()
324328

325329
if(LLVM_ENABLE_TERMINFO)

0 commit comments

Comments
 (0)