aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)