diff --git a/CMakeLists.txt b/CMakeLists.txt index a8605fa4..3985ff71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,5 @@ cmake_minimum_required (VERSION 2.6) -if (NOT DEFINED CMAKE_BUILD_TYPE) - set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type") -endif () - project (libnfc C) SET(VERSION_MAJOR "1") @@ -15,6 +11,9 @@ SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") SET(PACKAGE_NAME "libnfc") SET(PACKAGE_VERSION ${VERSION}) SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +SET(PACKAGE_DESCRIPTION "Near Field Communication (NFC) library") + +INCLUDE(GNUInstallDirs) # config.h IF(WIN32) @@ -67,31 +66,23 @@ ENDIF(LIBNFC_CONFFILES_MODE) option (BUILD_EXAMPLES "build examples ON/OFF" ON) option (BUILD_UTILS "build utils ON/OFF" ON) -option (BUILD_DEBPKG "build debian package ON/OFF" OFF) +if(MSVC) + option (BUILD_MANUAL "build man-pages ON/OFF" OFF) +else(MSVC) + option (BUILD_MANUAL "build man-pages ON/OFF" ON) +endif(MSVC) +option (INSTALL_BUNDLE "Assemble a standalone bundle application" OFF) # Doxygen SET(builddir "${CMAKE_BINARY_DIR}") SET(top_srcdir "${CMAKE_SOURCE_DIR}") INCLUDE(UseDoxygen) -IF(DEFINED CMAKE_INSTALL_LIBDIR) - SET(libdir ${CMAKE_INSTALL_LIBDIR}) -ELSE(DEFINED CMAKE_INSTALL_LIBDIR) - SET(CMAKE_INSTALL_LIBDIR lib) - SET(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) -ENDIF(DEFINED CMAKE_INSTALL_LIBDIR) - -IF(DEFINED INCLUDE_INSTALL_DIR) - SET(includedir ${INCLUDE_INSTALL_DIR}) -ELSE(DEFINED INCLUDE_INSTALL_DIR) - SET(INCLUDE_INSTALL_DIR include) - SET(includedir ${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}) -ENDIF(DEFINED INCLUDE_INSTALL_DIR) - -IF(NOT DEFINED SHARE_INSTALL_PREFIX) - SET(SHARE_INSTALL_PREFIX share) -ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX) +SET(prefix ${CMAKE_INSTALL_PREFIX}) +SET(exec_prefix ${CMAKE_INSTALL_PREFIX}) +SET(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) +SET(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) # Additonnal GCC flags IF(CMAKE_COMPILER_IS_GNUCC) @@ -126,28 +117,36 @@ IF(MINGW) ENDIF (NOT DLLTOOL) ENDIF(MINGW) +# pkg-config IF(NOT WIN32) - # Set some pkg-config variables - SET(prefix ${CMAKE_INSTALL_PREFIX}) - SET(exec_prefix ${CMAKE_INSTALL_PREFIX}) - SET(PACKAGE "libnfc") - IF(LIBNFC_DRIVER_PN53X_USB) - SET(PKG_REQ ${PKG_REQ} "libusb") - ENDIF(LIBNFC_DRIVER_PN53X_USB) - IF(LIBNFC_DRIVER_ACR122_USB) - SET(PKG_REQ ${PKG_REQ} "libusb") - ENDIF(LIBNFC_DRIVER_ACR122_USB) + IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + IF(LIBNFC_DRIVER_PN53X_USB) + SET(PKG_REQ ${PKG_REQ} "libusb-0.1") + ENDIF(LIBNFC_DRIVER_PN53X_USB) + IF(LIBNFC_DRIVER_ACR122_USB) + SET(PKG_REQ ${PKG_REQ} "libusb-0.1") + ENDIF(LIBNFC_DRIVER_ACR122_USB) + ELSE(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + IF(LIBNFC_DRIVER_PN53X_USB) + SET(PKG_REQ ${PKG_REQ} "libusb") + ENDIF(LIBNFC_DRIVER_PN53X_USB) + IF(LIBNFC_DRIVER_ACR122_USB) + SET(PKG_REQ ${PKG_REQ} "libusb") + ENDIF(LIBNFC_DRIVER_ACR122_USB) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") IF(LIBNFC_DRIVER_PCSC) SET(PKG_REQ ${PKG_REQ} "libpcsclite") ENDIF(LIBNFC_DRIVER_PCSC) IF(LIBNFC_DRIVER_ACR122_PCSC) SET(PKG_REQ ${PKG_REQ} "libpcsclite") ENDIF(LIBNFC_DRIVER_ACR122_PCSC) - # CMake lists are separated by a semi colon, replace with colon - STRING(REPLACE ";" "," PKG_CONFIG_REQUIRES "${PKG_REQ}") - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libnfc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc @ONLY) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ENDIF(NOT WIN32) +LIST(SORT PKG_REQ) +LIST(REMOVE_DUPLICATES PKG_REQ) +# CMake lists are separated by a semi colon, replace with colon +STRING(REPLACE ";" "," PKG_CONFIG_REQUIRES "${PKG_REQ}") +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libnfc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) INCLUDE(LibnfcDrivers) @@ -167,16 +166,15 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") ENDIF(I2C_REQUIRED) ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") -IF(PCSC_INCLUDE_DIRS) +IF(PCSC_FOUND) INCLUDE_DIRECTORIES(${PCSC_INCLUDE_DIRS}) LINK_DIRECTORIES(${PCSC_LIBRARY_DIRS}) -ENDIF(PCSC_INCLUDE_DIRS) +ENDIF(PCSC_FOUND) -IF(LIBUSB_INCLUDE_DIRS) +IF(LIBUSB_FOUND) INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS}) LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS}) - SET(LIBUSB_FOUND TRUE) -ENDIF(LIBUSB_INCLUDE_DIRS) +ENDIF(LIBUSB_FOUND) # version.rc for Windows IF(WIN32) @@ -202,72 +200,40 @@ if (BUILD_EXAMPLES) add_subdirectory (examples) endif () -if (NOT MSVC) - # config script install path - if ( NOT DEFINED LIBNFC_CMAKE_CONFIG_DIR ) - set ( LIBNFC_CMAKE_CONFIG_DIR lib${LIB_SUFFIX}/cmake/libnfc ) - endif () - - set ( LIBNFC_INCLUDE_DIR ${includedir} ) - set ( LIBNFC_INCLUDE_DIRS ${LIBNFC_INCLUDE_DIR} ) - list ( APPEND LIBNFC_INCLUDE_DIRS ${LIBUSB_INCLUDE_DIRS} ) - set ( LIBNFC_LIBRARY nfc ) - set ( LIBNFC_LIBRARIES ${LIBNFC_LIBRARY} ) - list ( APPEND LIBNFC_LIBRARIES ${LIBUSB_LIBRARIES} ) - set ( LIBNFC_LIBRARY_DIRS ${libdir} ) - set ( LIBNFC_ROOT_DIR ${prefix} ) - set ( LIBNFC_VERSION_STRING ${VERSION} ) - set ( LIBNFC_VERSION_MAJOR ${VERSION_MAJOR} ) - set ( LIBNFC_VERSION_MINOR ${VERSION_MINOR} ) - set ( LIBNFC_VERSION_PATCH ${VERSION_PATCH} ) - - set ( LIBNFC_USE_FILE ${CMAKE_INSTALL_PREFIX}/${LIBNFC_CMAKE_CONFIG_DIR}/UseLibNFC.cmake ) - - - - if(CMAKE_VERSION VERSION_LESS 2.8.8) - configure_file ( cmake/LibNFCConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfig.cmake @ONLY ) - configure_file ( cmake/LibNFCConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfigVersion.cmake @ONLY ) - else () - include(CMakePackageConfigHelpers) - configure_package_config_file ( - cmake/LibNFCConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfig.cmake - INSTALL_DESTINATION ${LIBNFC_CMAKE_CONFIG_DIR} - PATH_VARS - LIBNFC_USE_FILE - LIBNFC_ROOT_DIR - LIBNFC_INCLUDE_DIR - LIBNFC_INCLUDE_DIRS - LIBNFC_LIBRARY_DIRS - NO_CHECK_REQUIRED_COMPONENTS_MACRO - ) - write_basic_package_version_file ( - LibNFCConfigVersion.cmake - VERSION ${LIBNFC_VERSION_STRING} - COMPATIBILITY AnyNewerVersion - ) - endif () - - install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfigVersion.cmake - cmake/UseLibNFC.cmake - DESTINATION ${LIBNFC_CMAKE_CONFIG_DIR} - ) - -endif () - -# Binary Package -IF(WIN32) - SET(CPACK_GENERATOR "ZIP") -ELSE(WIN32) - SET(CPACK_GENERATOR "TBZ2") - IF(BUILD_DEBPKG) - SET(CPACK_GENERATOR "DEB") - ENDIF(BUILD_DEBPKG) -ENDIF(WIN32) - -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Near Field Communication (NFC) library") +set(INCLUDE_INSTALL_DIRS ${includedir}) +set(LIBNFC_CMAKE_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}) +set(LIBNFC_DEFINITIONS "") +set(LIBNFC_LIBRARIES ${LIBNFC_LIBRARY}) +list(APPEND LIBNFC_LIBRARIES ${PKG_REQ}) +set(LIBNFC_LIBRARY nfc) +set(LIBNFC_USE_FILE UseLibNFC.cmake) +set(LIBRARY_INSTALL_DIRS ${libdir}) + +include(CMakePackageConfigHelpers) +configure_package_config_file( + cmake/LibNFCConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfig.cmake + INSTALL_DESTINATION ${LIBNFC_CMAKE_CONFIG_DIR} + PATH_VARS INCLUDE_INSTALL_DIRS LIBRARY_INSTALL_DIRS +) +write_basic_package_version_file( + LibNFCConfigVersion.cmake + VERSION ${VERSION} + COMPATIBILITY AnyNewerVersion +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/LibNFCConfigVersion.cmake + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseLibNFC.cmake + DESTINATION ${LIBNFC_CMAKE_CONFIG_DIR} +) + +#install required libraries +IF(INSTALL_BUNDLE) + CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY) + INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) +ENDIF(INSTALL_BUNDLE) + +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PACKAGE_DESCRIPTION}) SET(CPACK_PACKAGE_VENDOR "Roel Verdult") SET(CPACK_PACKAGE_CONTACT "Roel Verdult ") @@ -295,13 +261,12 @@ SET(CPACK_COMPONENT_HEADERS_DISABLED TRUE) SET(CPACK_COMPONENT_HEADERS_DEPENDS libraries) SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries) +# Binary Package +SET(CPACK_GENERATOR "ZIP" CACHE STRING "Default binary package generator") # Source Package -IF(WIN32) - SET(CPACK_SOURCE_GENERATOR "ZIP") -ELSE(WIN32) - SET(CPACK_SOURCE_GENERATOR "ZIP;TBZ2") -ENDIF(WIN32) - +SET(CPACK_SOURCE_GENERATOR "SOURCE_ZIP" CACHE STRING "Default source package generator") SET(CPACK_SOURCE_PACKAGE_FILE_NAME "libnfc-${VERSION}") SET(CPACK_SOURCE_IGNORE_FILES "~$" "/\\\\.git/" "bin/") + +INCLUDE(InstallRequiredSystemLibraries) INCLUDE(CPack) diff --git a/cmake/FixBundle.cmake.in b/cmake/FixBundle.cmake.in index 6e8f843d..c336be5e 100644 --- a/cmake/FixBundle.cmake.in +++ b/cmake/FixBundle.cmake.in @@ -6,6 +6,6 @@ SET(bundle "${CMAKE_INSTALL_PREFIX}/bin/nfc-list@CMAKE_EXECUTABLE_SUFFIX@") # set other_libs to a list of additional libs that cannot be reached by dependency analysis SET(other_libs "") -SET(dirs "@LIBUSB_LIBRARY_DIR@") +SET(dirs "@LIBUSB_LIBRARY_DIRS@") fixup_bundle("${bundle}" "${other_libs}" "${dirs}") diff --git a/cmake/LibNFCConfig.cmake.in b/cmake/LibNFCConfig.cmake.in index c2375df1..d794fbe1 100644 --- a/cmake/LibNFCConfig.cmake.in +++ b/cmake/LibNFCConfig.cmake.in @@ -5,30 +5,27 @@ # LIBNFC_FOUND - True if LibNFC was found on your system # LIBNFC_USE_FILE - The file making LibNFC usable # LIBNFC_DEFINITIONS - Definitions needed to build with LibNFC -# LIBNFC_INCLUDE_DIR - Directory where nfc/nfc.h can be found # LIBNFC_INCLUDE_DIRS - List of directories of LibNFC and it's dependencies # LIBNFC_LIBRARY - LibNFC library location # LIBNFC_LIBRARIES - List of libraries to link against LibNFC library # LIBNFC_LIBRARY_DIRS - List of directories containing LibNFC' libraries -# LIBNFC_ROOT_DIR - The base directory of LibNFC # LIBNFC_VERSION_STRING - A human-readable string containing the version # LIBNFC_VERSION_MAJOR - The major version of LibNFC # LIBNFC_VERSION_MINOR - The minor version of LibNFC # LIBNFC_VERSION_PATCH - The patch version of LibNFC +@PACKAGE_INIT@ + set ( LIBNFC_FOUND 1 ) -set ( LIBNFC_USE_FILE "@LIBNFC_USE_FILE@" ) +set ( LIBNFC_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/@LIBNFC_USE_FILE@" ) set ( LIBNFC_DEFINITIONS "@LIBNFC_DEFINITIONS@" ) -set ( LIBNFC_INCLUDE_DIR "@LIBNFC_INCLUDE_DIR@" ) -set ( LIBNFC_INCLUDE_DIRS "@LIBNFC_INCLUDE_DIRS@" ) +set ( LIBNFC_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIRS@" ) set ( LIBNFC_LIBRARY "@LIBNFC_LIBRARY@" ) set ( LIBNFC_LIBRARIES "@LIBNFC_LIBRARIES@" ) -set ( LIBNFC_LIBRARY_DIRS "@LIBNFC_LIBRARY_DIRS@" ) -set ( LIBNFC_ROOT_DIR "@LIBNFC_ROOT_DIR@" ) - -set ( LIBNFC_VERSION_STRING "@LIBNFC_VERSION_STRING@" ) -set ( LIBNFC_VERSION_MAJOR "@LIBNFC_VERSION_MAJOR@" ) -set ( LIBNFC_VERSION_MINOR "@LIBNFC_VERSION_MINOR@" ) -set ( LIBNFC_VERSION_PATCH "@LIBNFC_VERSION_PATCH@" ) +set ( LIBNFC_LIBRARY_DIRS "@PACKAGE_LIBRARY_INSTALL_DIRS@" ) +set ( LIBNFC_VERSION_STRING "@VERSION@" ) +set ( LIBNFC_VERSION_MAJOR @VERSION_MAJOR@ ) +set ( LIBNFC_VERSION_MINOR @VERSION_MINOR@ ) +set ( LIBNFC_VERSION_PATCH @VERSION_PATCH@ ) diff --git a/cmake/modules/FindLIBUSB.cmake b/cmake/modules/FindLIBUSB.cmake index 4afd8afa..4d0bc9e5 100644 --- a/cmake/modules/FindLIBUSB.cmake +++ b/cmake/modules/FindLIBUSB.cmake @@ -1,63 +1,29 @@ -# This CMake script wants to use libusb functionality, therefore it looks -# for libusb include files and libraries. +# - Try to find libusb or libusb-win32 +# Once done this will define # -# Operating Systems Supported: -# - Unix (requires pkg-config) -# Tested with Ubuntu 9.04 and Fedora 11 -# - Windows (requires MinGW) -# Tested with Windows XP/Windows 7 -# -# This should work for both 32 bit and 64 bit systems. -# -# Author: F. Kooman +# LIBUSB_FOUND - True if libusb found +# LIBUSB_INCLUDE_DIRS - The path to the libusb headers +# LIBUSB_LIBRARY_DIRS - The path to the libusb library +# LIBUSB_LIBRARIES - The libraries needed by libusb # -# 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) +FIND_PACKAGE(PkgConfig) +# Skip searching for libusb-0.1 on Windows, use libusb-win32 instead +IF(PKG_CONFIG_FOUND AND NOT WIN32) + PKG_SEARCH_MODULE(LIBUSB libusb libusb-0.1) + PKG_CHECK_MODULES(LIBUSB ${LIBUSB_MODULE_NAME}) +ENDIF(PKG_CONFIG_FOUND AND NOT WIN32) IF(NOT LIBUSB_FOUND) - IF(WIN32) - IF(MINGW) - FIND_PATH(LIBUSB_INCLUDE_DIRS lusb0_usb.h "${CMAKE_CURRENT_BINARY_DIR}/LibUSB-Win32/include" NO_SYSTEM_ENVIRONMENT_PATH) - FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb PATHS "${CMAKE_CURRENT_BINARY_DIR}/LibUSB-Win32/lib/gcc") - SET(LIBUSB_LIBRARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/LibUSB-Win32/bin/x86/") - ELSE(MINGW) - FIND_PATH(LIBUSB_INCLUDE_DIRS lusb0_usb.h "$ENV{ProgramW6432}/libusb-win32/include" NO_SYSTEM_ENVIRONMENT_PATH) - FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb PATHS "$ENV{ProgramW6432}/libusb-win32/lib/msvc_x64") - SET(LIBUSB_LIBRARY_DIR "$ENV{ProgramW6432}/libusb-win32/bin/amd64/") - ENDIF(MINGW) - # Must fix up variable to avoid backslashes during packaging - STRING(REGEX REPLACE "\\\\" "/" LIBUSB_LIBRARY_DIR ${LIBUSB_LIBRARY_DIR}) - ELSE(WIN32) - # If not under Windows we use PkgConfig - FIND_PACKAGE (PkgConfig) - IF(PKG_CONFIG_FOUND) - PKG_CHECK_MODULES(LIBUSB REQUIRED libusb) - ELSE(PKG_CONFIG_FOUND) - MESSAGE(FATAL_ERROR "Could not find PkgConfig") - ENDIF(PKG_CONFIG_FOUND) - ENDIF(WIN32) - - IF(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES) - SET(LIBUSB_FOUND TRUE) - ENDIF(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES) + FIND_PATH(LIBUSB_INCLUDE_DIRS NAMES usb.h lusb0_usb.h) + FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb libusb0) + GET_FILENAME_COMPONENT(LIBUSB_LIBRARY_DIRS ${LIBUSB_LIBRARIES} PATH CACHE) ENDIF(NOT LIBUSB_FOUND) -IF(LIBUSB_FOUND) - IF(NOT LIBUSB_FIND_QUIETLY) - MESSAGE(STATUS "Found LIBUSB: ${LIBUSB_LIBRARIES} ${LIBUSB_INCLUDE_DIRS}") - ENDIF (NOT LIBUSB_FIND_QUIETLY) -ELSE(LIBUSB_FOUND) - IF(LIBUSB_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find LIBUSB") - ENDIF(LIBUSB_FIND_REQUIRED) -ENDIF(LIBUSB_FOUND) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB REQUIRED_VARS + LIBUSB_INCLUDE_DIRS + LIBUSB_LIBRARIES + LIBUSB_LIBRARY_DIRS +) +MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES LIBUSB_LIBRARY_DIRS) diff --git a/cmake/modules/FindPCSC.cmake b/cmake/modules/FindPCSC.cmake index fa8f6a90..bb972dfc 100644 --- a/cmake/modules/FindPCSC.cmake +++ b/cmake/modules/FindPCSC.cmake @@ -13,7 +13,6 @@ FIND_PACKAGE (PkgConfig) IF(PKG_CONFIG_FOUND) # Will find PC/SC library on Linux/BSDs using PkgConfig PKG_CHECK_MODULES(PCSC libpcsclite) -# PKG_CHECK_MODULES(PCSC QUIET libpcsclite) # IF CMake >= 2.8.2? ENDIF(PKG_CONFIG_FOUND) IF(NOT PCSC_FOUND) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 01a93c9b..8b9b0f9f 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -SET(EXAMPLES-SOURCES +SET(SOURCES nfc-anticol nfc-dep-initiator nfc-dep-target @@ -17,7 +17,7 @@ SET(EXAMPLES-SOURCES INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libnfc) # Examples -FOREACH(source ${EXAMPLES-SOURCES}) +FOREACH(source ${SOURCES}) SET (TARGETS ${source}.c) IF(WIN32) @@ -38,18 +38,11 @@ FOREACH(source ${EXAMPLES-SOURCES}) ADD_EXECUTABLE(${source} ${TARGETS}) TARGET_LINK_LIBRARIES(${source} nfc) TARGET_LINK_LIBRARIES(${source} nfcutils) - INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT examples) + INSTALL(TARGETS ${source} RUNTIME COMPONENT examples) ENDFOREACH(source) -#install required libraries -IF(WIN32) - INCLUDE(InstallRequiredSystemLibraries) - CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY) - INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) -ENDIF(WIN32) - -IF(NOT WIN32) +IF(BUILD_MANUAL) # Manuals for the examples FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1") - INSTALL(FILES ${manuals} DESTINATION ${SHARE_INSTALL_PREFIX}/man/man1 COMPONENT manuals) -ENDIF(NOT WIN32) + INSTALL(FILES ${manuals} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT manuals) +ENDIF(BUILD_MANUAL) diff --git a/include/nfc/CMakeLists.txt b/include/nfc/CMakeLists.txt index c11d4794..568baa44 100644 --- a/include/nfc/CMakeLists.txt +++ b/include/nfc/CMakeLists.txt @@ -1,4 +1,4 @@ # Headers FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -INSTALL(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/nfc COMPONENT headers) +INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nfc COMPONENT headers) diff --git a/libnfc.pc.in b/libnfc.pc.in index d795823e..555f4f4b 100644 --- a/libnfc.pc.in +++ b/libnfc.pc.in @@ -3,8 +3,8 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: libnfc -Description: Near Field Communication (NFC) library +Name: @PACKAGE_NAME@ +Description: @PACKAGE_DESCRIPTION@ Version: @VERSION@ Requires: @PKG_CONFIG_REQUIRES@ Libs: -L${libdir} -lnfc diff --git a/libnfc/CMakeLists.txt b/libnfc/CMakeLists.txt index d3321778..1b0ebd66 100644 --- a/libnfc/CMakeLists.txt +++ b/libnfc/CMakeLists.txt @@ -74,7 +74,7 @@ IF(LIBNFC_LOG) LIST(APPEND LIBRARY_SOURCES log.c log-internal.c) ENDIF(WIN32) ENDIF(LIBNFC_LOG) -ADD_LIBRARY(nfc SHARED ${LIBRARY_SOURCES}) +ADD_LIBRARY(nfc ${LIBRARY_SOURCES}) IF(PCSC_FOUND) TARGET_LINK_LIBRARIES(nfc ${PCSC_LIBRARIES}) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index b9c723ea..0ae7112b 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,4 +1,4 @@ -SET(UTILS-SOURCES +SET(SOURCES nfc-barcode nfc-emulate-forum-tag4 nfc-jewel @@ -16,7 +16,7 @@ ADD_LIBRARY(nfcutils STATIC TARGET_LINK_LIBRARIES(nfcutils nfc) # Examples -FOREACH(source ${UTILS-SOURCES}) +FOREACH(source ${SOURCES}) SET (TARGETS ${source}.c) IF(WIN32) @@ -52,18 +52,11 @@ FOREACH(source ${UTILS-SOURCES}) TARGET_LINK_LIBRARIES(${source} nfc) TARGET_LINK_LIBRARIES(${source} nfcutils) - INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT utils) + INSTALL(TARGETS ${source} RUNTIME COMPONENT utils) ENDFOREACH(source) -#install required libraries -IF(WIN32) - INCLUDE(InstallRequiredSystemLibraries) - CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY) - INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) -ENDIF(WIN32) - -IF(NOT WIN32) +IF(BUILD_MANUAL) # Manuals for the examples FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1") - INSTALL(FILES ${manuals} DESTINATION ${SHARE_INSTALL_PREFIX}/man/man1 COMPONENT manuals) -ENDIF(NOT WIN32) + INSTALL(FILES ${manuals} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT manuals) +ENDIF(BUILD_MANUAL)