@@ -89,11 +89,9 @@ endif()
8989
9090set (ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)" )
9191set (ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries" )
92- set (ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries" )
93- set (ZIG_STATIC_ZLIB off CACHE BOOL "Prefer linking against static zlib" )
94- set (ZIG_ENABLE_ZSTD on CACHE BOOL "Enable linking zstd" )
95- set (ZIG_ENABLE_LIBCPP on CACHE BOOL "Enable linking libcpp" )
96- set (ZIG_STATIC_ZSTD off CACHE BOOL "Prefer linking against static zstd" )
92+ set (ZIG_STATIC_LLVM ${ZIG_STATIC} CACHE BOOL "Prefer linking against static LLVM libraries" )
93+ set (ZIG_STATIC_ZLIB ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zlib" )
94+ set (ZIG_STATIC_ZSTD ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zstd" )
9795set (ZIG_USE_CCACHE off CACHE BOOL "Use ccache" )
9896
9997if (ZIG_USE_CCACHE)
@@ -105,12 +103,6 @@ if(ZIG_USE_CCACHE)
105103 endif ()
106104endif ()
107105
108- if (ZIG_STATIC)
109- set (ZIG_STATIC_LLVM ON )
110- set (ZIG_STATIC_ZLIB ON )
111- set (ZIG_STATIC_ZSTD ON )
112- endif ()
113-
114106if (ZIG_SHARED_LLVM AND ZIG_STATIC_LLVM)
115107 message (SEND_ERROR "-DZIG_SHARED_LLVM and -DZIG_STATIC_LLVM cannot both be enabled simultaneously" )
116108endif ()
@@ -150,8 +142,13 @@ if(ZIG_STATIC_ZLIB)
150142 list (APPEND LLVM_LIBRARIES "${ZLIB} " )
151143endif ()
152144
153- if (ZIG_STATIC_ZSTD AND ZIG_ENABLE_ZSTD)
154- list (REMOVE_ITEM LLVM_SYSTEM_LIBRARIES "-lzstd" )
145+ if (ZIG_STATIC_ZSTD)
146+ if (MSVC )
147+ list (REMOVE_ITEM LLVM_SYSTEM_LIBRARIES "zstd.lib" )
148+ else ()
149+ list (REMOVE_ITEM LLVM_SYSTEM_LIBRARIES "-lzstd" )
150+ endif ()
151+
155152 find_library (ZSTD NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR )
156153 list (APPEND LLVM_LIBRARIES "${ZSTD} " )
157154endif ()
0 commit comments