aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-10-07 18:58:00 +0200
committerRiccardo Spagni <ric@spagni.net>2018-10-07 18:58:00 +0200
commit9da6d2969bc50e028e59c4e9cd637ebe408294b7 (patch)
tree68a56a1a880f3997cf327a647d07574ca0e31e21
parentMerge pull request #4505 (diff)
parentLinux: Fix building of static binaries with hw device support (diff)
downloadmonero-9da6d2969bc50e028e59c4e9cd637ebe408294b7.tar.xz
Merge pull request #4506
cbdd6b91 Linux: Fix building of static binaries with hw device support (iDunk5400)
-rw-r--r--cmake/FindHIDAPI.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmake/FindHIDAPI.cmake b/cmake/FindHIDAPI.cmake
index a689fb4eb..9b45dcc4c 100644
--- a/cmake/FindHIDAPI.cmake
+++ b/cmake/FindHIDAPI.cmake
@@ -39,6 +39,20 @@ find_package_handle_standard_args(HIDAPI
if(HIDAPI_FOUND)
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}")
+ if((STATIC AND UNIX AND NOT APPLE) OR (DEPENDS AND CMAKE_SYSTEM_NAME STREQUAL "Linux"))
+ find_library(LIBUSB-1.0_LIBRARY usb-1.0)
+ find_library(LIBUDEV_LIBRARY udev)
+ if(LIBUSB-1.0_LIBRARY)
+ set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARIES};${LIBUSB-1.0_LIBRARY}")
+ if(LIBUDEV_LIBRARY)
+ set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARIES};${LIBUDEV_LIBRARY}")
+ else()
+ message(WARNING "libudev library not found, binaries may fail to link.")
+ endif()
+ else()
+ message(WARNING "libusb-1.0 library not found, binaries may fail to link.")
+ endif()
+ endif()
set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}")
endif()