Skip to content

Commit

Permalink
allow one to use system ZSTD
Browse files Browse the repository at this point in the history
  • Loading branch information
a-detiste committed Oct 23, 2024
1 parent aaca599 commit 5b98800
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if(CMAKE_PROJECT_NAME STREQUAL "chdr")
endif()
option(INSTALL_STATIC_LIBS "Install static libraries" OFF)
option(WITH_SYSTEM_ZLIB "Use system provided zlib library" OFF)
option(WITH_SYSTEM_ZSTD "Use system provided zstd library" OFF)

option(BUILD_LTO "Compile libchdr with link-time optimization if supported" OFF)
if(BUILD_LTO)
Expand Down Expand Up @@ -41,11 +42,17 @@ else()
endif()

# zstd
option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" OFF)
option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" OFF)
option(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF)
add_subdirectory(deps/zstd-1.5.6/build/cmake EXCLUDE_FROM_ALL)
list(APPEND CHDR_LIBS libzstd_static)
if (WITH_SYSTEM_ZSTD)
find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
find_library(ZSTD_LIBRARIES NAMES zstd HINTS ${ZSTD_ROOT_DIR}/lib)
list(APPEND CHDR_LIBS zstd)
else()
option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" OFF)
option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" OFF)
option(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF)
add_subdirectory(deps/zstd-1.5.6/build/cmake EXCLUDE_FROM_ALL)
list(APPEND CHDR_LIBS libzstd_static)
endif()
#--------------------------------------------------
# chdr
#--------------------------------------------------
Expand Down

0 comments on commit 5b98800

Please sign in to comment.