File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -620,11 +620,27 @@ endif()
620620option (CURL_ZSTD "Set to ON to enable building curl with zstd support." OFF )
621621set (HAVE_ZSTD OFF )
622622if (CURL_ZSTD)
623- find_package (Zstd REQUIRED )
623+ hunter_add_package (zstd )
624+ if (HUNTER_ENABLED)
625+ find_package (zstd CONFIG REQUIRED )
626+ set (Zstd_FOUND "${zstd_FOUND} " )
627+ set (Zstd_VERSION "${zstd_VERSION} " )
628+ else ()
629+ find_package (Zstd REQUIRED )
630+ endif ()
624631 if (Zstd_FOUND AND NOT Zstd_VERSION VERSION_LESS "1.0.0" )
625632 set (HAVE_ZSTD ON )
633+ if (TARGET zstd::libzstd_static) # prefer zstd CMake targets
634+ list (APPEND CURL_LIBS zstd::libzstd_static)
635+ message (STATUS "found zstd ${Zstd_VERSION} , linking against target zstd::libzstd_static" )
636+ elseif (TARGET zstd::libzstd_shared)
637+ list (APPEND CURL_LIBS zstd::libzstd_shared)
638+ message (STATUS "found zstd ${Zstd_VERSION} , linking against target zstd::libzstd_shared" )
639+ else () # no indent to keep diffs small
640+ message (STATUS "found zstd ${Zstd_VERSION} , but no specific cmake target" )
626641 list (APPEND CURL_LIBS ${Zstd_LIBRARIES} )
627642 include_directories (${Zstd_INCLUDE_DIRS} )
643+ endif ()
628644 else ()
629645 message (WARNING "zstd v1.0.0 or newer is required, disabling zstd support." )
630646 endif ()
You can’t perform that action at this time.
0 commit comments