Fix CMakeLists for FreeBSD.

This commit is contained in:
Romain Tartiere 2009-12-01 13:26:34 +00:00
parent 56219ced36
commit dedfbb0ec8
3 changed files with 19 additions and 0 deletions

View file

@ -12,6 +12,19 @@
# Author: F. Kooman <fkooman@tuxed.net> # Author: F. Kooman <fkooman@tuxed.net>
# #
# FreeBSD has built-in libusb since 800069
IF(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
EXEC_PROGRAM(sysctl ARGS -n kern.osreldate OUTPUT_VARIABLE FREEBSD_VERSION)
SET(MIN_FREEBSD_VERSION 800068)
IF(FREEBSD_VERSION GREATER ${MIN_FREEBSD_VERSION})
SET(LIBUSB_FOUND TRUE)
SET(LIBUSB_INCLUDE_DIRS "/usr/include")
SET(LIBUSB_LIBRARIES "usb")
SET(LIBUSB_LIBRARY_DIRS "/usr/lib/")
ENDIF(FREEBSD_VERSION GREATER ${MIN_FREEBSD_VERSION})
ENDIF(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
IF(NOT LIBUSB_FOUND)
IF(MSVC) IF(MSVC)
# Windows with Microsoft Visual C++ # Windows with Microsoft Visual C++
FIND_PATH(LIBUSB_INCLUDE_DIRS usb.h "$ENV{ProgramFiles}/LibUSB-Win32/include") FIND_PATH(LIBUSB_INCLUDE_DIRS usb.h "$ENV{ProgramFiles}/LibUSB-Win32/include")
@ -35,6 +48,7 @@ ENDIF(MSVC)
IF(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES) IF(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES)
SET(LIBUSB_FOUND TRUE) SET(LIBUSB_FOUND TRUE)
ENDIF(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES) ENDIF(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES)
ENDIF(NOT LIBUSB_FOUND)
IF(LIBUSB_FOUND) IF(LIBUSB_FOUND)
IF(NOT LIBUSB_FIND_QUIETLY) IF(NOT LIBUSB_FIND_QUIETLY)

View file

@ -2,6 +2,9 @@ SET(EXAMPLES-SOURCES nfc-list nfc-mfclassic nfc-mfultralight nfcip-initiator nfc
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../lib) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../lib)
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS})
LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS} ${PCSC_LIBRARY_DIRS})
# Examples # Examples
FOREACH(source ${EXAMPLES-SOURCES}) FOREACH(source ${EXAMPLES-SOURCES})
ADD_EXECUTABLE(${source} ${source}.c) ADD_EXECUTABLE(${source} ${source}.c)

View file

@ -26,6 +26,8 @@ IF(LIBNFC_USB)
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn531_usb" "drivers/pn533_usb") SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn531_usb" "drivers/pn533_usb")
ENDIF(LIBNFC_USB) ENDIF(LIBNFC_USB)
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS})
LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS} ${PCSC_LIBRARY_DIRS})
# Library # Library
SET(LIBRARY_SOURCES nfc bitutils ${DRIVERS_SOURCES} ${BUSES_SOURCES} ${CHIPS_SOURCES}) SET(LIBRARY_SOURCES nfc bitutils ${DRIVERS_SOURCES} ${BUSES_SOURCES} ${CHIPS_SOURCES})