summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindSNAPPY.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /cmake/modules/FindSNAPPY.cmake
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/FindSNAPPY.cmake')
-rw-r--r--cmake/modules/FindSNAPPY.cmake58
1 files changed, 58 insertions, 0 deletions
diff --git a/cmake/modules/FindSNAPPY.cmake b/cmake/modules/FindSNAPPY.cmake
new file mode 100644
index 0000000..afcfc71
--- /dev/null
+++ b/cmake/modules/FindSNAPPY.cmake
@@ -0,0 +1,58 @@
+#
+# - Find snappy
+# Find Snappy includes and library
+#
+# SNAPPY_INCLUDE_DIRS - where to find snappy.h, etc.
+# SNAPPY_LIBRARIES - List of libraries when using Snappy.
+# SNAPPY_FOUND - True if Snappy found.
+# SNAPPY_DLL_DIR - (Windows) Path to the Snappy DLL
+# SNAPPY_DLL - (Windows) Name of the Snappy DLL
+
+include( FindWSWinLibs )
+FindWSWinLibs( "snappy-.*" "SNAPPY_HINTS" )
+
+if( NOT USE_REPOSITORY)
+ find_package(PkgConfig QUIET)
+ pkg_search_module(SNAPPY QUIET libsnappy)
+endif()
+
+find_path(SNAPPY_INCLUDE_DIR
+ NAMES snappy.h
+ HINTS "${SNAPPY_INCLUDEDIR}" "${SNAPPY_HINTS}/include"
+ /usr/include
+ /usr/local/include
+)
+
+find_library(SNAPPY_LIBRARY
+ NAMES snappy
+ HINTS "${SNAPPY_LIBDIR}" "${SNAPPY_HINTS}/lib"
+ PATHS
+ /usr/lib
+ /usr/local/lib
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args( SNAPPY DEFAULT_MSG SNAPPY_LIBRARY SNAPPY_INCLUDE_DIR )
+
+if( SNAPPY_FOUND )
+ set( SNAPPY_INCLUDE_DIRS ${SNAPPY_INCLUDE_DIR} )
+ set( SNAPPY_LIBRARIES ${SNAPPY_LIBRARY} )
+ if (WIN32)
+ set ( SNAPPY_DLL_DIR "${SNAPPY_HINTS}/bin"
+ CACHE PATH "Path to Snappy DLL"
+ )
+ file( GLOB _snappy_dll RELATIVE "${SNAPPY_DLL_DIR}"
+ "${SNAPPY_DLL_DIR}/snappy*.dll"
+ )
+ set ( SNAPPY_DLL ${_snappy_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "Snappy DLL file name"
+ )
+ mark_as_advanced( SNAPPY_DLL_DIR SNAPPY_DLL )
+ endif()
+else()
+ set( SNAPPY_INCLUDE_DIRS )
+ set( SNAPPY_LIBRARIES )
+endif()
+
+mark_as_advanced( SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIRS )