commit 8fc7b4d1401a70358bf54023363178d9c3e1f9de (tree)
parent 0010288dae32d12af60edd3f287025030a3f5dcd
Author: Andrew Kelley <andrew@ziglang.org>
Date: Tue, 25 Oct 2022 18:29:39 -0700
CMake: handle zstd the same as zlib
This is a new dependency of LLVM 15.
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -88,6 +88,7 @@ set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not com
set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries")
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
set(ZIG_STATIC_ZLIB off CACHE BOOL "Prefer linking against static zlib")
+set(ZIG_STATIC_ZSTD off CACHE BOOL "Prefer linking against static zstd")
set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available")
if(CCACHE_PROGRAM AND ZIG_USE_CCACHE)
@@ -97,6 +98,7 @@ endif()
if(ZIG_STATIC)
set(ZIG_STATIC_LLVM ON)
set(ZIG_STATIC_ZLIB ON)
+ set(ZIG_STATIC_ZSTD ON)
endif()
if (ZIG_SHARED_LLVM AND ZIG_STATIC_LLVM)
@@ -137,6 +139,12 @@ if(ZIG_STATIC_ZLIB)
list(APPEND LLVM_LIBRARIES "${ZLIB}")
endif()
+if(ZIG_STATIC_ZSTD)
+ list(REMOVE_ITEM LLVM_LIBRARIES "-lzstd")
+ find_library(ZSTD NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR)
+ list(APPEND LLVM_LIBRARIES "${ZSTD}")
+endif()
+
if(APPLE AND ZIG_STATIC)
list(REMOVE_ITEM LLVM_LIBRARIES "-lcurses")
find_library(CURSES NAMES libcurses.a libncurses.a NAMES_PER_DIR