From e60ccb8965bbc1a460bf85bfc87b885cf1260151 Mon Sep 17 00:00:00 2001 From: Patrick Roth Date: Fri, 4 Oct 2019 10:17:42 +0200 Subject: Initial commit import from github --- cmake/FindLibUSB.cmake | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 cmake/FindLibUSB.cmake (limited to 'cmake/FindLibUSB.cmake') diff --git a/cmake/FindLibUSB.cmake b/cmake/FindLibUSB.cmake new file mode 100644 index 0000000..6468937 --- /dev/null +++ b/cmake/FindLibUSB.cmake @@ -0,0 +1,30 @@ +# - Try to find libusb-1.0 +# Once done, this will define +# +# LIBUSB_FOUND - system has libusb-1.0 +# LIBUSB_INCLUDE_DIRS - the libusb-1.0 include directories +# LIBUSB_LIBRARIES - link these to use libusb-1.0 + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +# libfind_pkg_check_modules(LIBUSB_PKGCONF libusb-1.0>=1.0.19) +libfind_pkg_check_modules(LIBUSB_PKGCONF libusb-1.0) + +# Include dir +find_path(LIBUSB_INCLUDE_DIR + NAMES libusb.h + PATHS ${LIBUSB_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(LIBUSB_LIBRARY + NAMES usb-1.0 + PATHS ${LIBUSB_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(LIBUSB_PROCESS_INCLUDES LIBUSB_INCLUDE_DIR) +set(LIBUSB_PROCESS_LIBS LIBUSB_LIBRARY) +libfind_process(LIBUSB) -- cgit v1.2.1