Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmake/FindLIBUSB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
pkg_check_modules(PC_LIBUSB libusb-1.0)
ENDIF(NOT WIN32)
FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h
HINTS $ENV{LIBUSB_ROOT}/include/libusb-1.0
PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES usb-1.0
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES usb usb-1.0 libusb-1.0
HINTS $ENV{LIBUSB_ROOT}/VS2019/MS32/static
PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
Comment on lines +24 to 26
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kilograham Looking at https://cmake.org/cmake/help/latest/command/find_library.html have I actually got HINTS and PATHS the wrong way around?
i.e. does the usage of ${PC_LIBUSB_LIBDIR} count as "computed by system introspection" meaning that it ought to use the HINTS option; and does the usage of $ENV{LIBUSB_ROOT} count as a "hard-coded guess" meaning that it ought to use the PATHS option?

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)