From 1dfd32e115e46cb8d4bb849fae1faf1abb7bfa22 Mon Sep 17 00:00:00 2001 From: Dominic Spill Date: Mon, 7 Apr 2014 15:23:13 +0100 Subject: [PATCH] Make flag optional if libbluetooth is installed --- host/ubertooth-tools/src/CMakeLists.txt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/host/ubertooth-tools/src/CMakeLists.txt b/host/ubertooth-tools/src/CMakeLists.txt index aefa7338..2207dd50 100644 --- a/host/ubertooth-tools/src/CMakeLists.txt +++ b/host/ubertooth-tools/src/CMakeLists.txt @@ -23,6 +23,7 @@ find_package(BTBB REQUIRED) find_package(PCAP) +find_package(BLUETOOTH) if(MSVC) include_directories(../getopt) @@ -54,13 +55,16 @@ endif() LIST(APPEND TOOLS ubertooth-rx ubertooth-dump ubertooth-util ubertooth-btle) -if(USE_BLUEZ) - find_package(BLUETOOTH REQUIRED) - if ( ${LIBBLUETOOTH_FOUND} ) - LIST(APPEND TOOLS ubertooth-follow ubertooth-scan) - include_directories(${LIBBLUETOOTH_INCLUDE_DIR}) - LIST(APPEND TOOLS_LINK_LIBS ${LIBBLUETOOTH_LIBRARIES}) - endif() +if( USE_BLUEZ AND NOT ${LIBBLUETOOTH_FOUND} ) + message( FATAL_ERROR + "Cannot find libbluetooth, which is required for USE_BLUEZ") + +endif() + +if ( ${LIBBLUETOOTH_FOUND} ) + LIST(APPEND TOOLS ubertooth-follow ubertooth-scan) + include_directories(${LIBBLUETOOTH_INCLUDE_DIR}) + LIST(APPEND TOOLS_LINK_LIBS ${LIBBLUETOOTH_LIBRARIES}) endif() foreach(tool ${TOOLS})