Skip to content

Commit d2fe697

Browse files
committed
Support zstd also via pkg-config
It doesn't always provide cmake config
1 parent dbc4af8 commit d2fe697

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,16 @@ elseif(HTTPLIB_USE_BROTLI_IF_AVAILABLE)
159159
endif()
160160

161161
if(HTTPLIB_REQUIRE_ZSTD)
162-
find_package(zstd REQUIRED)
162+
find_package(zstd)
163+
if(NOT zstd_FOUND)
164+
find_package(PkgConfig REQUIRED)
165+
pkg_check_modules(zstd REQUIRED IMPORTED_TARGET libzstd)
166+
add_library(zstd::libzstd ALIAS PkgConfig::zstd)
167+
endif()
163168
set(HTTPLIB_IS_USING_ZSTD TRUE)
164169
elseif(HTTPLIB_USE_ZSTD_IF_AVAILABLE)
165170
find_package(zstd QUIET)
171+
# TODO: try to find it via pkg-config
166172
set(HTTPLIB_IS_USING_ZSTD ${zstd_FOUND})
167173
endif()
168174

0 commit comments

Comments
 (0)