build: cleaned up and fixed PCSC detection

This commit is contained in:
Bernhard Miklautz 2014-02-09 15:49:33 +01:00
parent ec908a9d6b
commit 9148af363e
1 changed files with 15 additions and 15 deletions

View File

@ -1,26 +1,26 @@
# - Try to find PCSC
# Once done this will define
# PCSC_FOUND - pcsc was found
# PCSC_INCLUDE_DIRS - pcsc include directories
# PCSC_LIBRARIES - libraries needed for linking
include(FindPkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PCSC libpcsclite)
pkg_check_modules(PC_PCSC QUIET libpcsclite)
endif()
find_path(PCSC_INCLUDE_DIR pcsclite.h
PATHS ${PCSC_INCLUDE_DIRS}
PATH_SUFFIXES PCSC)
find_path(PCSC_INCLUDE_DIR pcsclite.h WinSCard.h
HINTS ${PC_PCSC_INCLUDEDIR} ${PC_PCSC_INCLUDE_DIRS}
PATH_SUFFIXES PCSC)
find_library(PCSC_LIBRARY pcsclite
PATHS ${PCSC_LIBRARY_DIRS})
find_library(PCSC_LIBRARY NAMES PCSC WinSCard pcsclite
HINTS ${PC_PCSC_LIBDIR} ${PC_PCSC_LIBRARY_DIRS})
# Windows and Mac detection from http://www.cmake.org/Bug/print_bug_page.php?bug_id=11325
IF(NOT PCSC_FOUND)
# Will find PC/SC headers both on Mac and Windows
FIND_PATH(PCSC_INCLUDE_DIRS WinSCard.h)
# PCSC library is for Mac, WinSCard library is for Windows
FIND_LIBRARY(PCSC_LIBRARY NAMES PCSC WinSCard)
ENDIF(NOT PCSC_FOUND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PCSC DEFAULT_MSG PCSC_LIBRARY PCSC_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCSC DEFAULT_MSG PCSC_INCLUDE_DIR PCSC_LIBRARY)
set(PCSC_LIBRARIES ${PCSC_LIBRARY})
set(PCSC_INCLUDE_DIRS ${PCSC_INCLUDE_DIR})
mark_as_advanced(PCSC_INCLUDE_DIR PCSC_LIBRARY)