[llvm] Fix config when static zstd libraries are not found (PR #113584)
Udit Agarwal via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 16:11:53 PDT 2024
https://github.com/uditagarwal97 updated https://github.com/llvm/llvm-project/pull/113584
>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 1/2] 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)
>From b6a84d3740be1b1b9767f2f51080b02e3746a5ab Mon Sep 17 00:00:00 2001
From: Udit Agarwal <udit.agarwal at intel.com>
Date: Tue, 29 Oct 2024 16:11:38 -0700
Subject: [PATCH 2/2] Fail if static zstd libs are not found
---
llvm/cmake/config-ix.cmake | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 03a532772cbfe5..6375280e03b386 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -161,6 +161,10 @@ 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)
+ # Fail if LLVM_ENABLE_ZSTD is FORCE_ON.
+ if(LLVM_ENABLE_ZSTD STREQUAL FORCE_ON)
+ message(FATAL_ERROR "Failed to find static zstd libraries, but LLVM_USE_STATIC_ZSTD=ON and LLVM_ENABLE_ZSTD=FORCE_ON.")
+ endif()
set(LLVM_ENABLE_ZSTD OFF)
else()
set(LLVM_ENABLE_ZSTD ${zstd_FOUND})
More information about the llvm-commits
mailing list