Fix builds on FreeBSD

Without this patch the cmake config assume that every UNIX system that
is not APPLE is automatically a linux system. This however causes
problems on FreeBSD and properly on other BSD systems.

We now explicitly check if the CMAKE_SYSTEM_NAME is set to Linux.
This commit is contained in:
Alexander Sieg 2021-08-14 11:58:54 +02:00
parent c8185c9eca
commit a884a45ab1
3 changed files with 11 additions and 11 deletions

View file

@ -158,7 +158,7 @@ ENDIF(NOT WIN32)
INCLUDE(LibnfcDrivers)
IF(UNIX AND NOT APPLE)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
IF(I2C_REQUIRED)
# Inspired from http://cmake.3232098.n2.nabble.com/RFC-cmake-analog-to-AC-SEARCH-LIBS-td7585423.html
INCLUDE (CheckFunctionExists)
@ -172,7 +172,7 @@ IF(UNIX AND NOT APPLE)
ENDIF (HAVE_CLOCK_GETTIME_IN_RT)
ENDIF (NOT HAVE_CLOCK_GETTIME)
ENDIF(I2C_REQUIRED)
ENDIF(UNIX AND NOT APPLE)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
IF(PCSC_INCLUDE_DIRS)
INCLUDE_DIRECTORIES(${PCSC_INCLUDE_DIRS})

View file

@ -3,13 +3,13 @@ SET(LIBNFC_DRIVER_ACR122_PCSC OFF CACHE BOOL "Enable ACR122 support (Depends on
SET(LIBNFC_DRIVER_ACR122_USB ON CACHE BOOL "Enable ACR122 support (Direct USB connection)")
SET(LIBNFC_DRIVER_ACR122S ON CACHE BOOL "Enable ACR122S support (Use serial port)")
SET(LIBNFC_DRIVER_ARYGON ON CACHE BOOL "Enable ARYGON support (Use serial port)")
IF(UNIX AND NOT APPLE)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(LIBNFC_DRIVER_PN532_I2C ON CACHE BOOL "Enable PN532 I2C support (Use I2C bus)")
SET(LIBNFC_DRIVER_PN532_SPI ON CACHE BOOL "Enable PN532 SPI support (Use SPI bus)")
ELSE(UNIX AND NOT APPLE)
ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(LIBNFC_DRIVER_PN532_I2C OFF CACHE BOOL "Enable PN532 I2C support (Use I2C bus)")
SET(LIBNFC_DRIVER_PN532_SPI OFF CACHE BOOL "Enable PN532 SPI support (Use SPI bus)")
ENDIF(UNIX AND NOT APPLE)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(LIBNFC_DRIVER_PN532_UART ON CACHE BOOL "Enable PN532 UART support (Use serial port)")
SET(LIBNFC_DRIVER_PN53X_USB ON CACHE BOOL "Enable PN531 and PN531 USB support (Depends on libusb)")

View file

@ -29,23 +29,23 @@ IF(UART_REQUIRED)
ENDIF(UART_REQUIRED)
IF(I2C_REQUIRED)
IF(UNIX AND NOT APPLE)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
LIST(APPEND BUSES_SOURCES buses/i2c)
ELSE(UNIX AND NOT APPLE)
ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# Only Linux is supported at the moment
#LIST(APPEND BUSES_SOURCES ../contrib/win32/libnfc/buses/i2c)
MESSAGE( FATAL_ERROR "I2C is only (yet) supported in Linux!" )
ENDIF(UNIX AND NOT APPLE)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
ENDIF(I2C_REQUIRED)
IF(SPI_REQUIRED)
IF(UNIX AND NOT APPLE)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
LIST(APPEND BUSES_SOURCES buses/spi)
ELSE(UNIX AND NOT APPLE)
ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# Only Linux is supported at the moment
#LIST(APPEND BUSES_SOURCES ../contrib/win32/libnfc/buses/spi)
MESSAGE( FATAL_ERROR "SPI is only (yet) supported in Linux!" )
ENDIF(UNIX AND NOT APPLE)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
ENDIF(SPI_REQUIRED)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/buses)