1
0
mirror of https://github.com/soarqin/DSP_Mods_TO.git synced 2025-12-12 01:23:31 +08:00

use FetchContent for zstd library

This commit is contained in:
2025-07-21 17:03:38 +08:00
parent 45a7552471
commit bf383de76d
2 changed files with 18 additions and 1 deletions

View File

@@ -5,13 +5,30 @@ project(zstdwrap)
add_library(zstdwrap SHARED
dllmain.c zstdwrap.c zstdwrap.h)
include(FetchContent)
set(ZSTD_BUILD_STATIC ON)
set(ZSTD_BUILD_SHARED OFF)
FetchContent_Declare(
zstd
DOWNLOAD_EXTRACT_TIMESTAMP ON
URL https://github.com/facebook/zstd/releases/download/v1.5.7/zstd-1.5.7.tar.gz
URL_HASH SHA256=eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3
SOURCE_SUBDIR build/cmake
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(zstd)
target_include_directories(zstdwrap PRIVATE ${zstd_SOURCE_DIR}/lib)
target_compile_definitions(zstdwrap PRIVATE ZSTDWRAP_EXPORTS ZSTDLIB_STATIC_API)
if(MSVC)
target_compile_options(zstdwrap PRIVATE /MT)
else()
target_link_options(zstdwrap PRIVATE -static)
endif()
target_link_libraries(zstdwrap PRIVATE zstd)
target_link_libraries(zstdwrap PRIVATE libzstd_static)
if(WIN32)
set_target_properties(zstdwrap PROPERTIES PREFIX "")
endif()