summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindSBC.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/FindSBC.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/FindSBC.cmake')
-rw-r--r--cmake/modules/FindSBC.cmake51
1 files changed, 51 insertions, 0 deletions
diff --git a/cmake/modules/FindSBC.cmake b/cmake/modules/FindSBC.cmake
new file mode 100644
index 0000000..e9b90d7
--- /dev/null
+++ b/cmake/modules/FindSBC.cmake
@@ -0,0 +1,51 @@
+# Find the native Bluetooth SBC Codec includes and library
+#
+# SBC_INCLUDE_DIRS - where to find sbc.h
+# SBC_LIBRARIES - List of libraries when using SBC
+# SBC_FOUND - True if SBC found
+# SBC_DLL_DIR - (Windows) Path to the SBC DLL
+# SBC_DLL - (Windows) Name of the SBC DLL
+
+include( FindWSWinLibs )
+FindWSWinLibs( "sbc-.*" "SBC_HINTS" )
+
+find_path( SBC_INCLUDE_DIR
+ NAMES
+ sbc/sbc.h
+ HINTS
+ "${SBC_HINTS}/include"
+)
+
+find_library( SBC_LIBRARY
+ NAMES
+ sbc
+ libsbc-1
+ HINTS
+ "${SBC_HINTS}/lib"
+)
+
+include( FindPackageHandleStandardArgs )
+find_package_handle_standard_args( SBC DEFAULT_MSG SBC_LIBRARY SBC_INCLUDE_DIR )
+
+if( SBC_FOUND )
+ set( SBC_INCLUDE_DIRS ${SBC_INCLUDE_DIR} )
+ set( SBC_LIBRARIES ${SBC_LIBRARY} )
+ if (WIN32)
+ set ( SBC_DLL_DIR "${SBC_HINTS}/bin"
+ CACHE PATH "Path to SBC DLL"
+ )
+ file( GLOB _sbc_dll RELATIVE "${SBC_DLL_DIR}"
+ "${SBC_DLL_DIR}/libsbc-*.dll"
+ )
+ set ( SBC_DLL ${_sbc_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "SBC DLL file name"
+ )
+ mark_as_advanced( SBC_DLL_DIR SBC_DLL )
+ endif()
+else()
+ set( SBC_INCLUDE_DIRS )
+ set( SBC_LIBRARIES )
+endif()
+
+mark_as_advanced( SBC_LIBRARIES SBC_INCLUDE_DIRS )