aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMartin Müller <mail@mueller-martin.net>2019-01-14 02:56:35 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2020-08-20 15:28:07 +0200
commitee7a60d5d7a3815d2f5ba6a5a4b5588ff6a8f815 (patch)
tree42929463749b3e268ece1da825abee7e828b0956 /CMakeLists.txt
parenta6e21cc458147ef028e0a77784b7ec43c6be6d1e (diff)
downloadlibnitrokey-ee7a60d5d7a3815d2f5ba6a5a4b5588ff6a8f815.tar.gz
libnitrokey-ee7a60d5d7a3815d2f5ba6a5a4b5588ff6a8f815.tar.bz2
CMake: Try to use pkg-config for hidapi on macOS141-cmake-hidapi-pkgconfig
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt14
1 files changed, 10 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 119ca79..f0fe6e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,10 +76,16 @@ add_library(nitrokey ${SOURCE_FILES})
set(HIDAPI_LIBUSB_NAME hidapi-libusb)
IF(APPLE)
- include_directories(hidapi/hidapi)
- add_library(hidapi-libusb STATIC hidapi/mac/hid.c )
- target_link_libraries(hidapi-libusb "-framework CoreFoundation" "-framework IOKit")
- target_link_libraries(nitrokey hidapi-libusb)
+ find_package(PkgConfig)
+ IF(PKG_CONFIG_FOUND)
+ pkg_search_module(HIDAPI REQUIRED hidapi)
+ target_link_libraries(nitrokey ${HIDAPI_LDFLAGS})
+ ELSE()
+ include_directories(hidapi/hidapi)
+ add_library(hidapi-libusb STATIC hidapi/mac/hid.c )
+ target_link_libraries(hidapi-libusb "-framework CoreFoundation" "-framework IOKit")
+ target_link_libraries(nitrokey hidapi-libusb)
+ ENDIF()
ELSEIF(UNIX)
# add_library(hidapi-libusb STATIC hidapi/libusb/hid.c )
find_package(PkgConfig)