Issue finding zstd
envgap__yhirose__cpp-httplib-2313
01 / FAILURE SIGNATURE
As reported upstream
The library worked on most of my machines, but strangely on one XUbuntu with version 6.18 httplib's CMakeLists could not find zstd, even though it was installed and `/usr/lib/x86_64-linux-gnu/cmake/zstd` contained `zstdConfig.cmake` and `zstdTargets.cmake`.
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
ad5839f0d1c579066de75a78f45be0e2aa2ef05c- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
yhirose/cpp-httplib #2313 · read the original issue
The library worked on most of my machines, but strangely on one XUbuntu with version 6.18 httplib's CMakeLists could not find zstd, even though it was installed and `/usr/lib/x86_64-linux-gnu/cmake/zstd` contained `zstdConfig.cmake` and `zstdTargets.cmake`.
```
CMake Error at build/_deps/cpp-httplib-src/CMakeLists.txt:273 (target_link_libraries): The link interface of target "httplib" contains: zstd::libzstd but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing.
```
I am unsure why exactly it failed on that particular machine and worked on my other.
However, i finally managed to make httplib still compile after adding:
```cmake
find_package(zstd CONFIG REQUIRED)
if (NOT TARGET zstd::libzstd)
add_library(zstd::libzstd INTERFACE IMPORTED)
set_property(TARGET zstd::libzstd PROPERTY
INTERFACE_LINK_LIBRARIES zstd)
endif()
```
Hope this helps, maybe you can use that information to harden your library.
P.S.: Thanks for your work, really enjoy your library so far.04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]