smartcard: fix PCSC detection/build on OS X

fixes #1683
This commit is contained in:
Bernhard Miklautz 2014-02-07 00:14:46 +01:00
parent 19ab10d819
commit 7815747d02
2 changed files with 23 additions and 1 deletions

View File

@ -31,8 +31,22 @@
#define BOOL PCSC_BOOL
#include <PCSC/pcsclite.h>
#include <PCSC/reader.h>
#include <PCSC/winscard.h>
#if !defined(__APPLE__)
#include <PCSC/reader.h>
#else
/* On OS X reader.h isn't available so define it here */
#endif
#define SCARD_CLASS_SYSTEM 0x7fff /**< System-specific definitions */
#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0003)
#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0005)
#ifdef UNICODE
#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_W /**< Reader's display name. */
#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_W /**< Reader's system name. */
#else
#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_A /**< Reader's display name. */
#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_A /**< Reader's system name. */
#endif
#undef BOOL
#include <winpr/crt.h>

View File

@ -12,6 +12,14 @@ find_path(PCSC_INCLUDE_DIR pcsclite.h
find_library(PCSC_LIBRARY pcsclite
PATHS ${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)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCSC DEFAULT_MSG PCSC_INCLUDE_DIR PCSC_LIBRARY)
mark_as_advanced(PCSC_INCLUDE_DIR PCSC_LIBRARY)