aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2020-08-20 14:58:59 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2020-08-20 14:58:59 +0200
commita6e21cc458147ef028e0a77784b7ec43c6be6d1e (patch)
tree8479d71e32e802280cd36c0f8d7d4a0413e89b47
parent3e36af0431cc5ec9d6c4176eb280386e557a0d40 (diff)
parentad04be95f8baea5818919eb27e78c2926733a8cb (diff)
downloadlibnitrokey-pre-v3.6.tar.gz
libnitrokey-pre-v3.6.tar.bz2
Merge branch '185-feat-adapt-hidapi-dependency-in-pkgconfig'pre-v3.6
Fix libnitrokey-1.pc generation on FreeBSD Fixes #185
-rw-r--r--CMakeLists.txt3
-rw-r--r--libnitrokey.pc.in2
-rw-r--r--meson.build12
3 files changed, 15 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d236f8..119ca79 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,6 +73,8 @@ set(SOURCE_FILES
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build all libraries as shared")
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 )
@@ -83,6 +85,7 @@ ELSEIF(UNIX)
find_package(PkgConfig)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
pkg_search_module(HIDAPI_LIBUSB REQUIRED hidapi)
+ set(HIDAPI_LIBUSB_NAME hidapi)
ELSE()
pkg_search_module(HIDAPI_LIBUSB REQUIRED hidapi-libusb)
ENDIF()
diff --git a/libnitrokey.pc.in b/libnitrokey.pc.in
index 17cde1d..4a50388 100644
--- a/libnitrokey.pc.in
+++ b/libnitrokey.pc.in
@@ -4,7 +4,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: libnitrokey
Description: Library for communicating with Nitrokey in a clean and easy manner
Version: @libnitrokey_VERSION@
-Requires.private: hidapi-libusb
+Requires.private: @HIDAPI_LIBUSB_NAME@
Libs: -L${libdir} -lnitrokey
Cflags: -I${includedir}
diff --git a/meson.build b/meson.build
index 8a51b66..58abb1b 100644
--- a/meson.build
+++ b/meson.build
@@ -107,12 +107,22 @@ ext_libnitrokey = declare_dependency(
include_directories : inc_libnitrokey,
)
+if meson.version().version_compare('>= 0.48.0')
+ dep_hidapi_name = dep_hidapi.name()
+else
+ if target_machine.system() == 'freebsd'
+ dep_hidapi_name = 'hidapi'
+ else
+ dep_hidapi_name = 'hidapi-libusb'
+ endif
+endif
+
pkg.generate(
name : meson.project_name(),
filebase : 'libnitrokey-1',
libraries : libnitrokey,
version : meson.project_version(),
- requires_private : 'hidapi-libusb',
+ requires_private : dep_hidapi_name,
description : 'Library for communicating with Nitrokey in a clean and easy manner',
install : true,
)