[llvm] Fix config when static zstd libraries are not found (PR #113584)

Udit Agarwal via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 08:33:39 PDT 2024


https://github.com/uditagarwal97 created https://github.com/llvm/llvm-project/pull/113584

Fixes: https://github.com/llvm/llvm-project/issues/113583

>From c58034c40b7d5ce489b553a44a7cef4c56ff39bd Mon Sep 17 00:00:00 2001
From: Udit Agarwal <udit.agarwal at intel.com>
Date: Thu, 24 Oct 2024 08:31:47 -0700
Subject: [PATCH] Fix config when static zstd libraries are not found

---
 llvm/cmake/config-ix.cmake | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 86f2bac7d23e84..03a532772cbfe5 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -157,7 +157,14 @@ if(LLVM_ENABLE_ZSTD)
     find_package(zstd QUIET)
   endif()
 endif()
+
+# If LLVM_USE_STATIC_ZSTD is specified, make sure we enable zstd only if static
+# libraries are found.
+if(LLVM_USE_STATIC_ZSTD AND NOT TARGET zstd::libzstd_static)
+set(LLVM_ENABLE_ZSTD OFF)
+else()
 set(LLVM_ENABLE_ZSTD ${zstd_FOUND})
+endif()
 
 if(LLVM_ENABLE_LIBXML2)
   if(LLVM_ENABLE_LIBXML2 STREQUAL FORCE_ON)



More information about the llvm-commits mailing list