refactor zstd cmake and prefer system lib
This commit is contained in:
parent
2d5478c19e
commit
738e1a2071
24
external/CMakeLists.txt
vendored
24
external/CMakeLists.txt
vendored
@ -28,29 +28,7 @@ if (NOT TARGET nlohmann_json::nlohmann_json)
|
||||
FetchContent_MakeAvailable(json)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET zstd::zstd)
|
||||
# TODO: try find_package() first
|
||||
# TODO: try pkg-config next (will work on most distros)
|
||||
|
||||
set(ZSTD_BUILD_STATIC ON)
|
||||
set(ZSTD_BUILD_SHARED OFF)
|
||||
set(ZSTD_BUILD_PROGRAMS OFF)
|
||||
set(ZSTD_BUILD_CONTRIB OFF)
|
||||
set(ZSTD_BUILD_TESTS OFF)
|
||||
FetchContent_Declare(zstd
|
||||
URL "https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz"
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
SOURCE_SUBDIR build/cmake
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
FetchContent_MakeAvailable(zstd)
|
||||
|
||||
add_library(zstd INTERFACE) # somehow zstd fkd this up
|
||||
target_include_directories(zstd INTERFACE ${zstd_SOURCE_DIR}/lib/)
|
||||
target_link_libraries(zstd INTERFACE libzstd_static)
|
||||
#TODO: new zstd also provides zstd::libzstd
|
||||
add_library(zstd::zstd ALIAS zstd)
|
||||
endif()
|
||||
add_subdirectory(./zstd)
|
||||
|
||||
#if (NOT TARGET solanaceae_plugin)
|
||||
#FetchContent_Declare(solanaceae_plugin
|
||||
|
32
external/zstd/CMakeLists.txt
vendored
Normal file
32
external/zstd/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
if (NOT TARGET zstd::libzstd)
|
||||
find_package(zstd CONFIG GLOBAL QUIET)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET zstd::libzstd)
|
||||
# TODO: try find_package() first
|
||||
# TODO: try pkg-config next (will work on most distros)
|
||||
|
||||
set(ZSTD_BUILD_STATIC ON)
|
||||
set(ZSTD_BUILD_SHARED OFF)
|
||||
set(ZSTD_BUILD_PROGRAMS OFF)
|
||||
set(ZSTD_BUILD_CONTRIB OFF)
|
||||
set(ZSTD_BUILD_TESTS OFF)
|
||||
FetchContent_Declare(zstd
|
||||
URL "https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz"
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
SOURCE_SUBDIR build/cmake
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
FetchContent_MakeAvailable(zstd)
|
||||
|
||||
add_library(libzstd_tmp INTERFACE) # somehow zstd fkd this up
|
||||
target_include_directories(libzstd_tmp INTERFACE ${zstd_SOURCE_DIR}/lib/)
|
||||
target_link_libraries(libzstd_tmp INTERFACE libzstd_static)
|
||||
#TODO: new zstd also provides zstd::libzstd
|
||||
add_library(zstd::libzstd ALIAS libzstd_tmp)
|
||||
endif()
|
||||
|
@ -32,7 +32,7 @@ target_include_directories(solanaceae_file2_zstd PUBLIC .)
|
||||
target_compile_features(solanaceae_file2_zstd PUBLIC cxx_std_17)
|
||||
target_link_libraries(solanaceae_file2_zstd PUBLIC
|
||||
solanaceae_file2
|
||||
zstd::zstd
|
||||
zstd::libzstd
|
||||
)
|
||||
|
||||
########################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user