summaryrefslogtreecommitdiffstats
path: root/Modules/FindUSB.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/FindUSB.cmake')
-rw-r--r--Modules/FindUSB.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/Modules/FindUSB.cmake b/Modules/FindUSB.cmake
new file mode 100644
index 0000000..d562b98
--- /dev/null
+++ b/Modules/FindUSB.cmake
@@ -0,0 +1,31 @@
1# - Try to find libusb-1.0
2# Once done, this will define
3#
4# USB_FOUND - system has libusb-1.0
5# USB_INCLUDE_DIRS - the libusb-1.0 include directories
6# USB_LIBRARIES - link these to use libusb-1.0
7
8include(LibFindMacros)
9
10# Dependencies
11
12# Use pkg-config to get hints about paths
13libfind_pkg_check_modules(USB_PKGCONF libusb-1.0)
14
15# Include dir
16find_path(USB_INCLUDE_DIR
17 NAMES libusb.h
18 PATHS ${USB_PKGCONF_INCLUDE_DIRS}
19)
20
21# Finally the library itself
22find_library(USB_LIBRARY
23 NAMES usb-1.0
24 PATHS ${USB_PKGCONF_LIBRARY_DIRS}
25)
26
27# Set the include dir variables and the libraries and let libfind_process do the rest.
28# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
29set(USB_PROCESS_INCLUDES USB_INCLUDE_DIR)
30set(USB_PROCESS_LIBS USB_LIBRARY)
31libfind_process(USB)