[llvm] [llvm-config] Make llvm-config --system-libs obey LLVM_USE_STATIC_ZSTD. (PR #93754)
Kyle Huey via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 17:12:22 PDT 2024
https://github.com/khuey created https://github.com/llvm/llvm-project/pull/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.
CC @MaskRay since zstd compression is relevant to his interests.
>From ecb1ff20c69d0a15b619a13a3a43b9f2c6ec9e23 Mon Sep 17 00:00:00 2001
From: Kyle Huey <khuey at kylehuey.com>
Date: Wed, 29 May 2024 16:33:55 -0700
Subject: [PATCH] [llvm-config] Make llvm-config --system-libs obey
LLVM_USE_STATIC_ZSTD.
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.
---
llvm/lib/Support/CMakeLists.txt | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 03e888958a071..1ab5bd370c480 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -321,8 +321,12 @@ if(LLVM_ENABLE_ZSTD)
if(NOT zstd_library)
get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION)
endif()
- get_library_name(${zstd_library} zstd_library)
- set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
+ if (zstd_target STREQUAL zstd::libzstd_shared)
+ get_library_name(${zstd_library} zstd_library)
+ set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
+ else()
+ set(llvm_system_libs ${llvm_system_libs} "${zstd_STATIC_LIBRARY}")
+ endif()
endif()
if(LLVM_ENABLE_TERMINFO)
More information about the llvm-commits
mailing list