Skip to content

Commit

Permalink
Use Hunter to download zstd
Browse files Browse the repository at this point in the history
  • Loading branch information
hjmallon committed Feb 28, 2023
1 parent 44561f6 commit b1ece6f
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -731,18 +731,28 @@ endif()
option(CURL_ZSTD "Set to ON to enable building curl with zstd support." OFF)
set(HAVE_ZSTD OFF)
if(CURL_ZSTD)
find_package(Zstd REQUIRED)
if (NOT DEFINED HAVE_ZSTD_CREATEDSTREAM)
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${Zstd_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${Zstd_LIBRARIES})
check_symbol_exists(ZSTD_createDStream "zstd.h" HAVE_ZSTD_CREATEDSTREAM)
cmake_pop_check_state()
endif()
if(Zstd_FOUND AND HAVE_ZSTD_CREATEDSTREAM)
set(HAVE_ZSTD ON)
list(APPEND CURL_LIBS ${Zstd_LIBRARIES})
include_directories(${Zstd_INCLUDE_DIRS})
hunter_add_package(zstd)
if(HUNTER_ENABLED)
find_package(zstd REQUIRED)
if(Zstd_FOUND AND HAVE_ZSTD_CREATEDSTREAM)
set(HAVE_ZSTD ON)
list(APPEND CURL_LIBS zstd::libzstd_static)
include_directories(${ZSTD_INCLUDE_DIRS})
endif()
else()
find_package(Zstd REQUIRED)
if (NOT DEFINED HAVE_ZSTD_CREATEDSTREAM)
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${Zstd_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${Zstd_LIBRARIES})
check_symbol_exists(ZSTD_createDStream "zstd.h" HAVE_ZSTD_CREATEDSTREAM)
cmake_pop_check_state()
endif()
if(Zstd_FOUND AND HAVE_ZSTD_CREATEDSTREAM)
set(HAVE_ZSTD ON)
list(APPEND CURL_LIBS ${Zstd_LIBRARIES})
include_directories(${Zstd_INCLUDE_DIRS})
endif()
endif()
endif()

Expand Down

0 comments on commit b1ece6f

Please sign in to comment.