link lz4 dynamically
It would be good to link lz4 dynamically. It can be done with
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9427b23..d0fdc49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,17 @@ if(BUILD_DOCS)
endif()
add_subdirectory(thirdparty/bitshuffle)
-add_subdirectory(thirdparty/lz4)
+
+option(SEEDEE_USE_EXTERNAL_LZ4 "Do not use the vendored version of lz4" OFF)
+if(SEEDEE_USE_EXTERNAL_LZ4)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(lz4 REQUIRED IMPORTED_TARGET liblz4)
+ set(SEEDEE_LZ4_TARGET_NAME PkgConfig::lz4)
+else()
+ add_subdirectory(thirdparty/lz4)
+ set(SEEDEE_LZ4_TARGET_NAME lz4)
+endif()
+
option(SEEDEE_USE_EXTERNAL_ZLIB "Do not use the vendored version of zlib" OFF)
if(SEEDEE_USE_EXTERNAL_ZLIB)
@@ -97,7 +107,7 @@ message(STATUS "SEEDEE_VERSION: ${SEEDEE_VERSION}")
add_library(seedee SHARED src/seedee.cpp)
target_compile_features(seedee PUBLIC cxx_std_11 c_std_99)
target_include_directories(seedee PUBLIC include)
-target_link_libraries(seedee PRIVATE bitshuffle lz4 ${SEEDEE_ZLIB_TARGET_NAME} nlohmann_json::nlohmann_json)
+target_link_libraries(seedee PRIVATE bitshuffle ${SEEDEE_LZ4_TARGET_NAME} ${SEEDEE_ZLIB_TARGET_NAME} nlohmann_json::nlohmann_json)
set_target_properties(seedee
PROPERTIES
VERSION ${SEEDEE_VERSION}