0002-cmake-fix-FindUSB1.cmake.patch 1.23 KB
From 81275d75ae88fe8ab1915d3ba260ea935e63c362 Mon Sep 17 00:00:00 2001
From: Samuel Martin <s.martin49@gmail.com>
Date: Sun, 25 Jan 2015 10:01:17 +0100
Subject: [PATCH 2/2] cmake: fix FindUSB1.cmake

Make sure all ldflags are correctly set, especially for static build.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
 cmake/FindUSB1.cmake | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/cmake/FindUSB1.cmake b/cmake/FindUSB1.cmake
index b90e297..e7f1b3c 100644
--- a/cmake/FindUSB1.cmake
+++ b/cmake/FindUSB1.cmake
@@ -26,8 +26,12 @@ else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
     PATH_SUFFIXES libusb-1.0
     PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
 
-  FIND_LIBRARY(LIBUSB_LIBRARIES NAMES usb-1.0
-    PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
+  set(LIBUSB_LIBRARIES ${PC_LIBUSB_STATIC_LDFLAGS} ${PC_LIBUSB_STATIC_LDFLAGS_OTHER})
+  foreach(libname ${PC_LIBUSB_STATIC_LIBRARIES})
+    FIND_LIBRARY(lib NAMES ${libname}
+      PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
+    list(APPEND LIBUSB_LIBRARIES ${lib})
+  endforeach()
 
   include(FindPackageHandleStandardArgs)
   FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
-- 
2.2.2