Added option to enable libudev in build (gives erros on RPi, but need on Ubuntu 13.10)

Former-commit-id: e3654fc4d9ff1e129c21247f1be21ad9599053fe
This commit is contained in:
Johan 2013-11-28 11:06:49 +01:00
parent 983ce30331
commit 6525e8b479
1 changed files with 15 additions and 4 deletions

View File

@ -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)