aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-16 22:35:16 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-16 22:35:16 +0200
commit613588e1a8d798f0b9e427f1e9db868080ad1bbf (patch)
tree74f4360a9aa1c924386ecb4af8690458824be924
parentMerge pull request #5409 (diff)
parentbuild: libusb static compilation fix (diff)
downloadmonero-613588e1a8d798f0b9e427f1e9db868080ad1bbf.tar.xz
Merge pull request #5410
d4a78c74 build: libusb static compilation fix (Dusan Klinec)
-rw-r--r--cmake/FindLibUSB.cmake11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmake/FindLibUSB.cmake b/cmake/FindLibUSB.cmake
index 7e3bf156e..c7e09d4c0 100644
--- a/cmake/FindLibUSB.cmake
+++ b/cmake/FindLibUSB.cmake
@@ -99,9 +99,18 @@ if ( LibUSB_FOUND )
check_library_exists ( "${LibUSB_LIBRARIES}" libusb_get_device_list "" LibUSB_VERSION_1.0 )
check_library_exists ( "${LibUSB_LIBRARIES}" libusb_get_port_numbers "" LibUSB_VERSION_1.0.16 )
+ if((STATIC AND UNIX AND NOT APPLE) OR (DEPENDS AND CMAKE_SYSTEM_NAME STREQUAL "Linux"))
+ find_library(LIBUDEV_LIBRARY udev)
+ if(LIBUDEV_LIBRARY)
+ set(LibUSB_LIBRARIES "${LibUSB_LIBRARIES};${LIBUDEV_LIBRARY}")
+ else()
+ message(WARNING "libudev library not found, binaries may fail to link.")
+ endif()
+ endif()
+
# Library 1.0.16+ compilation test.
# The check_library_exists does not work well on Apple with shared libs.
- if (APPLE OR LibUSB_VERSION_1.0.16)
+ if (APPLE OR LibUSB_VERSION_1.0.16 OR STATIC)
if (APPLE)
if(DEPENDS)
list(APPEND TEST_COMPILE_EXTRA_LIBRARIES "-framework Foundation -framework IOKit")