Added config files
This commit is contained in:
parent
e96061e44b
commit
ef74d81a8b
4 changed files with 125 additions and 0 deletions
|
@ -157,6 +157,61 @@ ADD_SUBDIRECTORY(include)
|
||||||
ADD_SUBDIRECTORY(utils)
|
ADD_SUBDIRECTORY(utils)
|
||||||
ADD_SUBDIRECTORY(examples)
|
ADD_SUBDIRECTORY(examples)
|
||||||
|
|
||||||
|
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
|
# Binary Package
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(CPACK_GENERATOR "ZIP")
|
SET(CPACK_GENERATOR "ZIP")
|
||||||
|
|
34
cmake/LibNFCConfig.cmake.in
Normal file
34
cmake/LibNFCConfig.cmake.in
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# -*- cmake -*-
|
||||||
|
|
||||||
|
|
||||||
|
# Use the following variables to compile and link against LibNFC:
|
||||||
|
# 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
|
||||||
|
|
||||||
|
set ( LIBNFC_FOUND 1 )
|
||||||
|
set ( LIBNFC_USE_FILE "@LIBNFC_USE_FILE@" )
|
||||||
|
|
||||||
|
set ( LIBNFC_DEFINITIONS "@LIBNFC_DEFINITIONS@" )
|
||||||
|
set ( LIBNFC_INCLUDE_DIR "@LIBNFC_INCLUDE_DIR@" )
|
||||||
|
set ( LIBNFC_INCLUDE_DIRS "@LIBNFC_INCLUDE_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@" )
|
||||||
|
|
31
cmake/LibNFCConfigVersion.cmake.in
Normal file
31
cmake/LibNFCConfigVersion.cmake.in
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# This is a basic version file for the Config-mode of find_package().
|
||||||
|
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||||
|
# to create a version-file which can be installed along a config.cmake file.
|
||||||
|
#
|
||||||
|
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||||
|
# the requested version string are exactly the same and it sets
|
||||||
|
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
|
||||||
|
# The variable CVF_VERSION must be set before calling configure_file().
|
||||||
|
|
||||||
|
set(PACKAGE_VERSION "@LIBNFC_VERSION_STRING@")
|
||||||
|
|
||||||
|
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
|
else()
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||||
|
if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||||
|
set(PACKAGE_VERSION_EXACT TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||||
|
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||||
|
if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||||
|
math(EXPR installedBits "8 * 8")
|
||||||
|
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||||
|
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||||
|
endif()
|
5
cmake/UseLibNFC.cmake
Normal file
5
cmake/UseLibNFC.cmake
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- cmake -*-
|
||||||
|
|
||||||
|
add_definitions ( ${LIBNFC_DEFINITIONS} )
|
||||||
|
include_directories ( ${LIBNFC_INCLUDE_DIRS} )
|
||||||
|
link_directories ( ${LIBNFC_LIBRARY_DIRS} )
|
Loading…
Reference in a new issue