From a422ae2211177f1865ec4e6a19405344ccb03c7e Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Mon, 18 Mar 2013 23:32:07 +0100 Subject: [PATCH] CMake: only compile usbbus.c when (at least) one USB driver is enabled --- cmake/modules/LibnfcDrivers.cmake | 1 + libnfc/CMakeLists.txt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/modules/LibnfcDrivers.cmake b/cmake/modules/LibnfcDrivers.cmake index 8611844..bbb9af3 100644 --- a/cmake/modules/LibnfcDrivers.cmake +++ b/cmake/modules/LibnfcDrivers.cmake @@ -14,6 +14,7 @@ IF(LIBNFC_DRIVER_PN53X_USB) FIND_PACKAGE(LIBUSB REQUIRED) ADD_DEFINITIONS("-DDRIVER_PN53X_USB_ENABLED") SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn53x_usb") + SET(USB_REQUIRED TRUE) ENDIF(LIBNFC_DRIVER_PN53X_USB) IF(LIBNFC_DRIVER_ARYGON) diff --git a/libnfc/CMakeLists.txt b/libnfc/CMakeLists.txt index 920e15e..db267e0 100644 --- a/libnfc/CMakeLists.txt +++ b/libnfc/CMakeLists.txt @@ -12,9 +12,9 @@ SET(CHIPS_SOURCES chips/pn53x) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/chips) # Library's buses -IF(LIBUSB_FOUND) - SET(BUSES_SOURCES buses/usbbus) -ENDIF(LIBUSB_FOUND) +IF(USB_REQUIRED) + LIST(APPEND BUSES_SOURCES buses/usbbus) +ENDIF(USB_REQUIRED) IF(UART_REQUIRED) LIST(APPEND BUSES_SOURCES buses/uart)