libnfc/src/CMakeLists.txt

68 lines
2.4 KiB
Text
Raw Normal View History

SET(LIBRARY-SOURCES libnfc rs232 bitutils dev_arygon dev_pn532_uart)
# find PCSC library and headers
IF(LIBNFC_PCSC)
FIND_PACKAGE(PCSC REQUIRED)
ADD_DEFINITIONS("-DHAVE_PCSC_LITE=1")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PCSC_CFLAGS_OTHER}")
SET(LIBRARY-SOURCES ${LIBRARY-SOURCES} "dev_acr122")
ENDIF(LIBNFC_PCSC)
2009-09-02 20:15:21 +00:00
# find libusb library and headers
IF(LIBNFC_USB)
FIND_PACKAGE(LIBUSB REQUIRED)
ADD_DEFINITIONS("-DHAVE_LIBUSB=1")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS_OTHER}")
SET(LIBRARY-SOURCES ${LIBRARY-SOURCES} "dev_pn531" "dev_pn533")
ENDIF(LIBNFC_USB)
2009-09-02 20:15:21 +00:00
IF(LIBNFC_VERBOSE_OUTPUT)
ADD_DEFINITIONS("-DDEBUG")
ENDIF(LIBNFC_VERBOSE_OUTPUT)
IF(LIBNFC_DISABLE_SERIAL_AUTOPROBE)
ADD_DEFINITIONS("-DDISABLE_SERIAL_AUTOPROBE")
ENDIF(LIBNFC_DISABLE_SERIAL_AUTOPROBE)
2009-09-02 20:15:21 +00:00
IF(LIBNFC_LANG_C99 AND NOT MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
ENDIF(LIBNFC_LANG_C99 AND NOT MSVC)
IF(MSVC)
# We should fix the code, not hide warning!
ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS")
2009-09-02 20:15:21 +00:00
# Include the stdint headers, because MSVC does not have them
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../win32/stdint)
2009-09-02 20:15:21 +00:00
ENDIF(MSVC)
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS})
2009-09-02 20:15:21 +00:00
# Library
ADD_LIBRARY(nfc SHARED ${LIBRARY-SOURCES})
TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES} ${PCSC_LIBRARIES})
2009-09-02 20:15:21 +00:00
SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 0 VERSION 0.0.0)
IF(MSVC)
# On Windows the shared (runtime) library should be either in the same
# directory as the excutables or in the path, we add it to same directory
INSTALL(TARGETS nfc RUNTIME DESTINATION bin COMPONENT libraries)
# At compile time we need the .LIB file, we place it in the lib directory
INSTALL(TARGETS nfc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT headers)
ELSE(MSVC)
INSTALL(TARGETS nfc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
ENDIF(MSVC)
# Headers
FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
INSTALL(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/libnfc COMPONENT headers)
IF(MSVC)
# On Windows we also install the stdint headers, without it programs using it
# can't compile (like if we want to compile the included examples "out of
# tree")
#FILE(GLOB stdint "${CMAKE_CURRENT_SOURCE_DIR}/msvc/*.h")
#INSTALL(FILES ${stdint} DESTINATION ${INCLUDE_INSTALL_DIR}/libnfc COMPONENT headers)
ENDIF(MSVC)
2009-10-06 10:01:18 +00:00
ADD_SUBDIRECTORY(examples)