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

Udit Kumar Agarwal via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 07:52:47 PDT 2025


================
@@ -196,7 +196,18 @@ 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)
+  # 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})
----------------
uditagarwal97 wrote:

Done in https://github.com/llvm/llvm-project/pull/113584/commits/c8447a8a4e821a3e844b733a1271f87ebacb1a9f

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


More information about the llvm-commits mailing list