mirror of
https://github.com/estkme-group/lpac
synced 2024-06-30 14:00:40 +02:00
feat: use pkgconfig instead of hard-coded PCSC path (#31)
Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com>
This commit is contained in:
parent
228fc5d56d
commit
dee7542145
|
@ -1,5 +1,7 @@
|
|||
option(LINUX_MINGW32 "Build for windows on Linux" OFF)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
if (APPLE)
|
||||
message(STATUS "Building for macOS")
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
|
||||
|
|
31
cmake/FindPCSCLite.cmake
Normal file
31
cmake/FindPCSCLite.cmake
Normal file
|
@ -0,0 +1,31 @@
|
|||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(PC_PCSCLITE libpcsclite)
|
||||
|
||||
find_path(PCSCLITE_INCLUDE_DIR
|
||||
NAMES winscard.h pcsclite.h wintypes.h debuglog.h ifdhandler.h reader.h
|
||||
HINTS ${PC_PCSCLITE_INCLUDEDIR}
|
||||
${PC_PCSCLITE_INCLUDE_DIRS}
|
||||
${PC_PCSCLITE_INCLUDE_DIRS}/PCSC
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
)
|
||||
find_library(PCSCLITE_LIBRARIES NAMES pcsclite libpcsclite PCSC
|
||||
HINTS ${PC_PCSCLITE_LIBDIR}
|
||||
${PC_PCSCLITE_LIBRARY_DIRS}
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib64
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set PCSCLITE_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PCSCLite DEFAULT_MSG PCSCLITE_LIBRARIES PCSCLITE_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(PCSCLITE_LIBRARIES PCSCLITE_INCLUDE_DIR)
|
||||
|
||||
if(PCSCLITE_FOUND AND NOT TARGET PCSCLite::PCSCLite)
|
||||
add_library(PCSCLite::PCSCLite UNKNOWN IMPORTED)
|
||||
set_target_properties(PCSCLite::PCSCLite PROPERTIES
|
||||
IMPORTED_LOCATION "${PCSCLITE_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PCSCLITE_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
|
@ -10,8 +10,8 @@ if(LINUX_MINGW32 OR CYGWIN)
|
|||
elseif (APPLE)
|
||||
target_link_libraries(apduinterface_pcsc "-framework PCSC")
|
||||
else()
|
||||
include_directories("/usr/include/PCSC")
|
||||
target_link_libraries(apduinterface_pcsc pcsclite)
|
||||
find_package(PCSCLite)
|
||||
target_link_libraries(apduinterface_pcsc PCSCLite::PCSCLite)
|
||||
endif()
|
||||
|
||||
add_library(apduinterface_at SHARED at.c)
|
||||
|
|
Loading…
Reference in a new issue