CMakeLists.txt: Add support to specifying Bluez version at build time

pull/118/head
Olivier Martin 2019-07-14 12:43:37 +02:00 committed by Olivier Martin
parent 4f8625cedf
commit e5daed3484
2 changed files with 25 additions and 12 deletions

View File

@ -42,10 +42,12 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
# Expose 'gattlib.h' to all sub-directories
include_directories(include)
# Check version of Bluez to know which backend we use (ie: Bluez code or DBus)
pkg_search_module(BLUEZ bluez)
if (NOT BLUEZ_FOUND)
message(FATAL_ERROR "Please install 'libbluetooth-dev'")
if (NOT BLUEZ_VERSION)
# Check version of Bluez to know which backend we use (ie: Bluez code or DBus)
pkg_search_module(BLUEZ bluez)
if (NOT BLUEZ_FOUND)
message(FATAL_ERROR "Please install 'libbluetooth-dev'")
endif()
endif()
# Extract Bluez version

View File

@ -3,14 +3,7 @@
GattLib is a library used to access Generic Attribute Profile (GATT) protocol of BLE (Bluetooth Low Energy) devices.
It has been introduced to allow to build applications that could easily communicate with BLE devices.
It supports Bluez v4 and v5. On Bluez versions prior to v5.42, gattlib used Bluez source code while it uses D-Bus API
from v5.42. D-Bus API can be used on version prior to Bluez v5.42 by using the CMake flag `-DGATTLIB_FORCE_DBUS=TRUE`:
```
mkdir build && cd build
cmake -DGATTLIB_FORCE_DBUS=TRUE ..
make
```
It supports Bluez v4 and v5.
Latest GattLib Release packages
===============================
@ -51,6 +44,24 @@ cmake ..
make
```
* Gattlib can also be built for a specific version of Bluez by specifying its version at build time:
```
mkdir build && cd build
cmake -DBLUEZ_VERSION=TRUE ..
make
```
* **On Bluez versions prior to v5.42**, gattlib used Bluez source code while it uses D-Bus API
from v5.42. D-Bus API can be used on version prior to Bluez v5.42 by using the CMake flag `-DGATTLIB_FORCE_DBUS=TRUE`:
```
mkdir build && cd build
cmake -DGATTLIB_FORCE_DBUS=TRUE ..
make
```
### Cross-Compilation
To cross-compile GattLib, you must provide the following environment variables: