mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 08:14:48 +00:00
cmake: fix handling of transitive zstd dependency
- Remove ZIG_ENABLE_ZSTD in favour of allowing ZIG_STATIC_ZSTD to be toggled off explicitly when ZIG_STATIC is on - Remove ZIG_ENABLE_LIBCPP (now unused)
This commit is contained in:
parent
88e442253b
commit
f5135f8e3b
@ -89,11 +89,9 @@ endif()
|
||||
|
||||
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
|
||||
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_ENABLE_ZSTD on CACHE BOOL "Enable linking zstd")
|
||||
set(ZIG_ENABLE_LIBCPP on CACHE BOOL "Enable linking libcpp")
|
||||
set(ZIG_STATIC_ZSTD off CACHE BOOL "Prefer linking against static zstd")
|
||||
set(ZIG_STATIC_LLVM ${ZIG_STATIC} CACHE BOOL "Prefer linking against static LLVM libraries")
|
||||
set(ZIG_STATIC_ZLIB ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zlib")
|
||||
set(ZIG_STATIC_ZSTD ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zstd")
|
||||
set(ZIG_USE_CCACHE off CACHE BOOL "Use ccache")
|
||||
|
||||
if(ZIG_USE_CCACHE)
|
||||
@ -105,12 +103,6 @@ if(ZIG_USE_CCACHE)
|
||||
endif()
|
||||
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)
|
||||
message(SEND_ERROR "-DZIG_SHARED_LLVM and -DZIG_STATIC_LLVM cannot both be enabled simultaneously")
|
||||
endif()
|
||||
@ -150,8 +142,13 @@ if(ZIG_STATIC_ZLIB)
|
||||
list(APPEND LLVM_LIBRARIES "${ZLIB}")
|
||||
endif()
|
||||
|
||||
if(ZIG_STATIC_ZSTD AND ZIG_ENABLE_ZSTD)
|
||||
list(REMOVE_ITEM LLVM_SYSTEM_LIBRARIES "-lzstd")
|
||||
if(ZIG_STATIC_ZSTD)
|
||||
if (MSVC)
|
||||
list(REMOVE_ITEM LLVM_SYSTEM_LIBRARIES "zstd.lib")
|
||||
else()
|
||||
list(REMOVE_ITEM LLVM_SYSTEM_LIBRARIES "-lzstd")
|
||||
endif()
|
||||
|
||||
find_library(ZSTD NAMES libzstd.a libzstdstatic.a zstd NAMES_PER_DIR)
|
||||
list(APPEND LLVM_LIBRARIES "${ZSTD}")
|
||||
endif()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user