From b6b356b948f90d813e09f97b0711840460646e88 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Mon, 18 Mar 2013 23:27:23 +0100 Subject: [PATCH] CMake: only include UART related files when (at least) one UART driver is enabled --- cmake/modules/LibnfcDrivers.cmake | 2 ++ libnfc/CMakeLists.txt | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmake/modules/LibnfcDrivers.cmake b/cmake/modules/LibnfcDrivers.cmake index 84a2bc9..8611844 100644 --- a/cmake/modules/LibnfcDrivers.cmake +++ b/cmake/modules/LibnfcDrivers.cmake @@ -19,11 +19,13 @@ ENDIF(LIBNFC_DRIVER_PN53X_USB) IF(LIBNFC_DRIVER_ARYGON) ADD_DEFINITIONS("-DDRIVER_ARYGON_ENABLED") SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/arygon") + SET(UART_REQUIRED TRUE) ENDIF(LIBNFC_DRIVER_ARYGON) IF(LIBNFC_DRIVER_PN532_UART) ADD_DEFINITIONS("-DDRIVER_PN532_UART_ENABLED") SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn532_uart") + SET(UART_REQUIRED TRUE) ENDIF(LIBNFC_DRIVER_PN532_UART) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/drivers) diff --git a/libnfc/CMakeLists.txt b/libnfc/CMakeLists.txt index f03f0ca..920e15e 100644 --- a/libnfc/CMakeLists.txt +++ b/libnfc/CMakeLists.txt @@ -13,10 +13,13 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/chips) # Library's buses IF(LIBUSB_FOUND) - SET(BUSES_SOURCES buses/uart buses/usbbus) -ELSE(LIBUSB_FOUND) - SET(BUSES_SOURCES buses/uart) + SET(BUSES_SOURCES buses/usbbus) ENDIF(LIBUSB_FOUND) + +IF(UART_REQUIRED) + LIST(APPEND BUSES_SOURCES buses/uart) +ENDIF(UART_REQUIRED) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/buses) IF(WIN32)