authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-10-25 18:29:39-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-10-25 18:29:39-07:00
log8fc7b4d1401a70358bf54023363178d9c3e1f9de
tree078cc5da3d7abd2f1b316bfcc8c33a55a91d3a61
parent0010288dae32d12af60edd3f287025030a3f5dcd

CMake: handle zstd the same as zlib

This is a new dependency of LLVM 15.

1 files changed, 8 insertions(+), 0 deletions(-)

CMakeLists.txt+8
......@@ -88,6 +88,7 @@ set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not com
8888set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries")
8989set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
9090set(ZIG_STATIC_ZLIB off CACHE BOOL "Prefer linking against static zlib")
91set(ZIG_STATIC_ZSTD off CACHE BOOL "Prefer linking against static zstd")
9192set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache if available")
9293
9394if(CCACHE_PROGRAM AND ZIG_USE_CCACHE)
......@@ -97,6 +98,7 @@ endif()
9798if(ZIG_STATIC)
9899 set(ZIG_STATIC_LLVM ON)
99100 set(ZIG_STATIC_ZLIB ON)
101 set(ZIG_STATIC_ZSTD ON)
100102endif()
101103
102104if (ZIG_SHARED_LLVM AND ZIG_STATIC_LLVM)
......@@ -137,6 +139,12 @@ if(ZIG_STATIC_ZLIB)
137139 list(APPEND LLVM_LIBRARIES "${ZLIB}")
138140endif()
139141
142if(ZIG_STATIC_ZSTD)
143 list(REMOVE_ITEM LLVM_LIBRARIES "-lzstd")
144 find_library(ZSTD NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR)
145 list(APPEND LLVM_LIBRARIES "${ZSTD}")
146endif()
147
140148if(APPLE AND ZIG_STATIC)
141149 list(REMOVE_ITEM LLVM_LIBRARIES "-lcurses")
142150 find_library(CURSES NAMES libcurses.a libncurses.a NAMES_PER_DIR