diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c31d7f..5f5edf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 0.17.1 - TBD +### Enhancements +- Added support for Conan-installed zstd (credit: @Hailios) + ### Bug fixes - Added missing copying of `ts_event` when upgrading structs from DBNv1 to DBNv2 - Fixed setting of compiler warnings and warnings that had accumulated diff --git a/CMakeLists.txt b/CMakeLists.txt index 72cb9ab..28dd7f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,7 +211,7 @@ target_link_libraries( OpenSSL::Crypto OpenSSL::SSL Threads::Threads - zstd::zstd + ${ZSTD_TARGET} ) target_compile_definitions( diff --git a/cmake/FindZstd.cmake b/cmake/FindZstd.cmake index c8d9c38..8af7b0b 100644 --- a/cmake/FindZstd.cmake +++ b/cmake/FindZstd.cmake @@ -50,3 +50,15 @@ if(ZSTD_FOUND AND NOT TARGET zstd::zstd) INTERFACE_INCLUDE_DIRECTORIES ${ZSTD_INCLUDE_DIR} ) endif() + +# Check if the Conan-provided target exists +if(TARGET zstd::libzstd_static) + # If the Conan target exists, use it + set(ZSTD_TARGET zstd::libzstd_static) +elseif(TARGET zstd::zstd) + # If the system-installed target exists, use it + set(ZSTD_TARGET zstd::zstd) +else() + # Error out if neither target is found + message(FATAL_ERROR "Zstd target not found.") +endif()