Skip to content

Commit 72eb75a

Browse files
committed
Merge pull request #270 from larshg/libusbFixs
Added depends search path.
2 parents 965b89c + e7bb3b9 commit 72eb75a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

examples/protonect/cmake_modules/FindLibUsb-1.0.cmake

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
# - Find libusb for portable USB support
2-
# This module will find libusb as published by
3-
# http://libusb.sf.net and
4-
# http://libusb-win32.sf.net
52
#
6-
# It will use PkgConfig if present and supported, else search
7-
# it on its own. If the LibUSB_ROOT environment variable
3+
# If the LibUSB_ROOT environment variable
84
# is defined, it will be used as base path.
95
# The following standard variables get defined:
106
# LibUSB_FOUND: true if LibUSB was found
117
# LibUSB_INCLUDE_DIR: the directory that contains the include file
12-
# LibUSB_LIBRARIES: the library
8+
# LibUSB_LIBRARIES: the libraries
139

1410
include ( CheckLibraryExists )
1511
include ( CheckIncludeFile )
@@ -18,7 +14,7 @@ find_path ( LibUSB_INCLUDE_DIR
1814
NAMES
1915
libusb.h
2016
PATHS
21-
$ENV{ProgramFiles}/LibUSB-Win32
17+
${CMAKE_SOURCE_DIR}/../../depends/libusbx/include
2218
$ENV{LibUSB_ROOT}
2319
PATH_SUFFIXES
2420
libusb
@@ -27,7 +23,7 @@ find_path ( LibUSB_INCLUDE_DIR
2723
mark_as_advanced ( LibUSB_INCLUDE_DIR )
2824

2925
if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" )
30-
# LibUSB-Win32 binary distribution contains several libs.
26+
# LibUSB binary distribution contains several libs.
3127
# Use the lib that got compiled with the same compiler.
3228
if ( MSVC )
3329
if ( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
@@ -44,7 +40,7 @@ find_library ( LibUSB_LIBRARY_RELEASE
4440
NAMES
4541
libusb libusb-1.0 usb
4642
PATHS
47-
$ENV{ProgramFiles}/LibUSB-Win32
43+
${CMAKE_SOURCE_DIR}/../../depends/libusbx/MS64
4844
$ENV{LibUSB_ROOT}
4945
PATH_SUFFIXES
5046
${LibUSB_LIBRARY_PATH_SUFFIX_RELEASE}
@@ -54,12 +50,17 @@ find_library ( LibUSB_LIBRARY_DEBUG
5450
NAMES
5551
libusb libusb-1.0 libusb-1.0d usb
5652
PATHS
57-
$ENV{ProgramFiles}/LibUSB-Win32
5853
$ENV{LibUSB_ROOT}
5954
PATH_SUFFIXES
6055
${LibUSB_LIBRARY_PATH_SUFFIX_DEBUG}
6156
)
6257

58+
if( ${LibUSB_LIBRARY_DEBUG} STREQUAL "LibUSB_LIBRARY_DEBUG-NOTFOUND" AND NOT ${LibUSB_LIBRARY_RELEASE} STREQUAL "LibUSB_LIBRARY_RELEASE-NOTFOUND")
59+
message(STATUS "Debug version not found - setting debug to release.")
60+
unset(LibUSB_LIBRARY_DEBUG CACHE)
61+
set(LibUSB_LIBRARY_DEBUG ${LibUSB_LIBRARY_RELEASE} CACHE STRING "LibUSB_LIBRARY_DEBUG")
62+
endif()
63+
6364
set (LibUSB_LIBRARIES
6465
debug ${LibUSB_LIBRARY_DEBUG}
6566
optimized ${LibUSB_LIBRARY_RELEASE}

0 commit comments

Comments
 (0)