Skip to content

Commit 70a1898

Browse files
committed
Correct find_scrpipt for libusb
The DEPENDS is only set for a local installation. Otherwise the system (global) one should used. Furthermore the check if libusb was actually found (even reuqired) was broken
1 parent 3990a23 commit 70a1898

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/protonect/cmake_modules/FindLibUSB.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@
88
# LibUSB_LIBRARIES: the libraries
99

1010
IF(PKG_CONFIG_FOUND)
11-
SET(ENV{PKG_CONFIG_PATH} "${DEPENDS_DIR}/libusb/lib/pkgconfig")
12-
PKG_CHECK_MODULES(LibUSB libusb-1.0)
11+
IF(${DEPENDS_DIR}) #Otherwise use System pkg-config path
12+
SET(ENV{PKG_CONFIG_PATH} "${DEPENDS_DIR}/libusb/lib/pkgconfig")
13+
ENDIF()
14+
IF(LibUSB_FIND_REQUIRED)
15+
PKG_CHECK_MODULES(LibUSB REQUIRED libusb-1.0)
16+
ELSE()
17+
PKG_CHECK_MODULES(LibUSB libusb-1.0)
18+
ENDIF()
1319
RETURN()
1420
ENDIF()
1521

0 commit comments

Comments
 (0)