aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorPiotr Smolinski <piotr.smolinski@confluent.io>2019-08-12 23:57:45 +0200
committerAnders Broman <a.broman58@gmail.com>2019-08-20 13:50:45 +0000
commitad94c4d459d243c0cbbb9b222d5f7cdf8189ab86 (patch)
tree06691a19b55777e1aad0a3f79c1ce6ceac0e9ae7 /cmake
parent8b8ce52abcf98f44bea025809c75f22224825ecb (diff)
Kafka: include zstd compression in Kafka message batches
Change-Id: I1d06486ccf7b174ee9aa621fa3d8acb8b3673777 Reviewed-on: https://code.wireshark.org/review/34222 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindZSTD.cmake58
1 files changed, 58 insertions, 0 deletions
diff --git a/cmake/modules/FindZSTD.cmake b/cmake/modules/FindZSTD.cmake
new file mode 100644
index 0000000000..d2d1f6207a
--- /dev/null
+++ b/cmake/modules/FindZSTD.cmake
@@ -0,0 +1,58 @@
+#
+# - Find zstd
+# Find Zstd includes and library
+#
+# ZSTD_INCLUDE_DIRS - where to find zstd.h, etc.
+# ZSTD_LIBRARIES - List of libraries when using Zstd.
+# ZSTD_FOUND - True if Zstd found.
+# ZSTD_DLL_DIR - (Windows) Path to the Zstd DLL
+# ZSTD_DLL - (Windows) Name of the Zstd DLL
+
+include( FindWSWinLibs )
+FindWSWinLibs( "zstd-.*" "ZSTD_HINTS" )
+
+if( NOT WIN32)
+ find_package(PkgConfig)
+ pkg_search_module(ZSTD libzstd)
+endif()
+
+find_path(ZSTD_INCLUDE_DIR
+ NAMES zstd.h
+ HINTS "${ZSTD_INCLUDEDIR}" "${ZSTD_HINTS}/include"
+ /usr/include
+ /usr/local/include
+)
+
+find_library(ZSTD_LIBRARY
+ NAMES zstd
+ HINTS "${ZSTD_LIBDIR}" "${ZSTD_HINTS}/lib"
+ PATHS
+ /usr/lib
+ /usr/local/lib
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args( ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR )
+
+if( ZSTD_FOUND )
+ set( ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR} )
+ set( ZSTD_LIBRARIES ${ZSTD_LIBRARY} )
+ if (WIN32)
+ set ( ZSTD_DLL_DIR "${ZSTD_HINTS}/bin"
+ CACHE PATH "Path to Zstd DLL"
+ )
+ file( GLOB _zstd_dll RELATIVE "${ZSTD_DLL_DIR}"
+ "${ZSTD_DLL_DIR}/zstd*.dll"
+ )
+ set ( ZSTD_DLL ${_zstd_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "Zstd DLL file name"
+ )
+ mark_as_advanced( ZSTD_DLL_DIR ZSTD_DLL )
+ endif()
+else()
+ set( ZSTD_INCLUDE_DIRS )
+ set( ZSTD_LIBRARIES )
+endif()
+
+mark_as_advanced( ZSTD_LIBRARIES ZSTD_INCLUDE_DIRS )