FindPCSC.cmake 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Copyright (C) 2021 KeePassXC Team <team@keepassxc.org>
  2. #
  3. # This program is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 2 or (at your option)
  6. # version 3 of the License.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. # Use pkgconfig on Linux
  16. if(NOT WIN32)
  17. find_package(PkgConfig QUIET)
  18. pkg_check_modules(PCSC libpcsclite)
  19. endif()
  20. if(NOT PCSC_FOUND)
  21. # Search for PC/SC headers on Mac and Windows
  22. find_path(PCSC_INCLUDE_DIRS winscard.h
  23. HINTS
  24. ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}
  25. /usr/include/PCSC
  26. PATH_SUFFIXES PCSC)
  27. # MAC library is PCSC, Windows library is WinSCard
  28. find_library(PCSC_LIBRARIES NAMES pcsclite libpcsclite WinSCard PCSC
  29. HINTS
  30. ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
  31. endif()
  32. include(FindPackageHandleStandardArgs)
  33. find_package_handle_standard_args(PCSC DEFAULT_MSG PCSC_LIBRARIES PCSC_INCLUDE_DIRS)
  34. mark_as_advanced(PCSC_LIBRARIES PCSC_INCLUDE_DIRS)