diff options
author | Martin Müller <mail@mueller-martin.net> | 2019-01-14 02:56:35 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2020-08-20 15:28:07 +0200 |
commit | ee7a60d5d7a3815d2f5ba6a5a4b5588ff6a8f815 (patch) | |
tree | 42929463749b3e268ece1da825abee7e828b0956 | |
parent | a6e21cc458147ef028e0a77784b7ec43c6be6d1e (diff) | |
download | libnitrokey-ee7a60d5d7a3815d2f5ba6a5a4b5588ff6a8f815.tar.gz libnitrokey-ee7a60d5d7a3815d2f5ba6a5a4b5588ff6a8f815.tar.bz2 |
CMake: Try to use pkg-config for hidapi on macOS141-cmake-hidapi-pkgconfig
-rw-r--r-- | CMakeLists.txt | 14 |
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) |