From 6525e8b479eb96ba9502024cdb93afb5c6fc071c Mon Sep 17 00:00:00 2001 From: Johan Date: Thu, 28 Nov 2013 11:06:49 +0100 Subject: [PATCH] Added option to enable libudev in build (gives erros on RPi, but need on Ubuntu 13.10) Former-commit-id: e3654fc4d9ff1e129c21247f1be21ad9599053fe --- libsrc/hyperion/CMakeLists.txt | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libsrc/hyperion/CMakeLists.txt b/libsrc/hyperion/CMakeLists.txt index bd0aa06a..5462fc85 100644 --- a/libsrc/hyperion/CMakeLists.txt +++ b/libsrc/hyperion/CMakeLists.txt @@ -4,16 +4,22 @@ SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/hyperion) SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/hyperion) #add libusb and pthreads (required for the Lighpack usb device) -#find_package(UDev REQUIRED) find_package(libusb-1.0 REQUIRED) find_package(Threads REQUIRED) -#find_package(UDev REQUIRED) include_directories( ../../include/hidapi -# ${UDEV_INCLUDE_DIR} ${LIBUSB_1_INCLUDE_DIRS}) # for Lightpack device +# set the build options +option (LIBUDEV_REQUIRED "Add libudev to the build (needed on Ubuntu 13.10, but gives errors when added on the RPi) :-S" OFF) +message(STATUS "LIBUDEV_REQUIRED = " ${LIBUDEV_REQUIRED}) + +if (LIBUDEV_REQUIRED) + find_package(UDev REQUIRED) + include_directories(${UDEV_INCLUDE_DIR}) +endif (LIBUDEV_REQUIRED) + # Group the headers that go through the MOC compiler SET(Hyperion_QT_HEADERS ${CURRENT_HEADER_DIR}/Hyperion.h @@ -89,6 +95,11 @@ target_link_libraries(hyperion serialport ${LIBUSB_1_LIBRARIES} #apt-get install libusb-1.0-0-dev ${CMAKE_THREAD_LIBS_INIT} -# ${UDEV_LIBRARIES} # apt-get install libudev-dev ${QT_LIBRARIES} ) + +if (LIBUDEV_REQUIRED) + target_link_libraries(hyperion + ${UDEV_LIBRARIES} # apt-get install libudev-dev + ) +endif (LIBUDEV_REQUIRED)