Skip to content

Commit

Permalink
[cmake] Add support for Bluetooth
Browse files Browse the repository at this point in the history
  • Loading branch information
hudokkow committed Dec 11, 2016
1 parent 2e68f8d commit 8f4063d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion project/cmake/CMakeLists.txt
Expand Up @@ -119,7 +119,7 @@ endif()
# Optional dependencies
set(optional_deps MicroHttpd MySqlClient SSH XSLT
Alsa UDEV DBus Avahi SmbClient
PulseAudio VDPAU VAAPI)
PulseAudio VDPAU VAAPI Bluetooth)

# Required, dyloaded deps
set(required_dyload Curl ASS)
Expand Down
9 changes: 5 additions & 4 deletions project/cmake/modules/FindBluetooth.cmake
Expand Up @@ -14,20 +14,20 @@
# Bluetooth::Bluetooth - The Bluetooth library

if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_BLUETOOTH bluetooth QUIET)
pkg_check_modules(PC_BLUETOOTH bluez bluetooth QUIET)
endif()

find_path(BLUETOOTH_INCLUDE_DIR NAMES bluetooth/bluetooth.h
PATHS ${PC_BLUETOOTH_INCLUDEDIR})
find_library(BLUETOOTH_LIBRARY NAMES bluetooth
find_library(BLUETOOTH_LIBRARY NAMES bluetooth libbluetooth
PATHS ${PC_BLUETOOTH_LIBDIR})

set(BLUETOOTH_VERSION ${PC_BLUETOOTH_VERSION})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Bluetooth
REQUIRED_VARS BLUETOOTH_LIBRARY BLUETOOTH_INCLUDE_DIR
VERSION_VAR ${BLUETOOTH_VERSION})
VERSION_VAR BLUETOOTH_VERSION)

if(BLUETOOTH_FOUND)
set(BLUETOOTH_INCLUDE_DIRS ${BLUETOOTH_INCLUDE_DIR})
Expand All @@ -37,7 +37,8 @@ if(BLUETOOTH_FOUND)
add_library(Bluetooth::Bluetooth UNKNOWN IMPORTED)
set_target_properties(Bluetooth::Bluetooth PROPERTIES
IMPORTED_LOCATION "${BLUETOOTH_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${BLUETOOTH_INCLUDE_DIR}")
INTERFACE_INCLUDE_DIRECTORIES "${BLUETOOTH_INCLUDE_DIR}"
INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLUETOOTH=1)
endif()
endif()

Expand Down

0 comments on commit 8f4063d

Please sign in to comment.