Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,17 @@ else()
endif()

if(WITH_ZSTD)
find_package(zstd REQUIRED)
find_package(zstd CONFIG)
if(zstd_DIR)
# Extract include dirs, because some targets (testutillib) use zstd headers without linking to zstd.
get_target_property(ZSTD_INCLUDE_DIRS zstd::libzstd INTERFACE_INCLUDE_DIRECTORIES)
list(APPEND THIRDPARTY_LIBS zstd::libzstd)
else()
find_package(zstd REQUIRED)
list(APPEND THIRDPARTY_LIBS zstd::zstd)
endif()
add_definitions(-DZSTD)
include_directories(${ZSTD_INCLUDE_DIRS})
list(APPEND THIRDPARTY_LIBS zstd::zstd)
endif()
endif()

Expand Down
4 changes: 3 additions & 1 deletion build_tools/format-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ fi
set -e

# Exclude third-party from formatting
EXCLUDE=':!third-party/'
# Exclude thirdparty.inc as it is a cmake file.
EXCLUDE="':!third-party/' ':!thirdparty.inc'"


uncommitted_code=`git diff HEAD`

Expand Down
13 changes: 11 additions & 2 deletions thirdparty.inc
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,19 @@ if (WITH_ZSTD)
set(ZSTD_LIB_RELEASE $ENV{ZSTD_LIB_RELEASE})
endif()

if(ZSTD_INCLUDE AND EXISTS "${ZSTD_INCLUDE}")
set(ZSTD_LIBS debug ${ZSTD_LIB_DEBUG} optimized ${ZSTD_LIB_RELEASE})
else()
# No explicit paths provided - try to find config package.
find_package(zstd CONFIG REQUIRED)
message(STATUS "zstd: found config at '${zstd_DIR}'.")
set(ZSTD_LIBS zstd::libzstd_static)
# Extract include dirs, because some targets (testutillib) use zstd headers without linking to zstd.
get_target_property(ZSTD_INCLUDE zstd::libzstd_static INTERFACE_INCLUDE_DIRECTORIES)
endif()

# ZSTD_STATIC_LINKING_ONLY only allows us to create an allocation functions override
# When jemalloc is in use
set(ZSTD_LIBS debug ${ZSTD_LIB_DEBUG} optimized ${ZSTD_LIB_RELEASE})

add_definitions(-DZSTD -DZSTD_STATIC_LINKING_ONLY)
include_directories(${ZSTD_INCLUDE})
set (THIRDPARTY_LIBS ${THIRDPARTY_LIBS} ${ZSTD_LIBS})
Expand Down