summaryrefslogtreecommitdiffstats
path: root/Modules/FindUSB.cmake
diff options
context:
space:
mode:
authorGravatar Hector Martin2009-08-20 03:42:52 +0200
committerGravatar Hector Martin2009-08-20 06:51:10 +0200
commit1a0c58e4062da7db73b4c08963f741cf016f6aa5 (patch)
treeb250f094e978d48622ecf652e28e9f3b68873893 /Modules/FindUSB.cmake
parentf4854f3fd725b5ba49cd5157d941783cffa08c04 (diff)
parent79ca4d9a3c3a82bb5a3f9be1ac7a2533c7a89b05 (diff)
downloadusbmuxd-1a0c58e4062da7db73b4c08963f741cf016f6aa5.tar.gz
usbmuxd-1a0c58e4062da7db73b4c08963f741cf016f6aa5.tar.bz2
Merge the two development histories
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 @@
+# - Try to find libusb-1.0
+# Once done, this will define
+#
+# USB_FOUND - system has libusb-1.0
+# USB_INCLUDE_DIRS - the libusb-1.0 include directories
+# USB_LIBRARIES - link these to use libusb-1.0
+
+include(LibFindMacros)
+
+# Dependencies
+
+# Use pkg-config to get hints about paths
+libfind_pkg_check_modules(USB_PKGCONF libusb-1.0)
+
+# Include dir
+find_path(USB_INCLUDE_DIR
+ NAMES libusb.h
+ PATHS ${USB_PKGCONF_INCLUDE_DIRS}
+)
+
+# Finally the library itself
+find_library(USB_LIBRARY
+ NAMES usb-1.0
+ PATHS ${USB_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(USB_PROCESS_INCLUDES USB_INCLUDE_DIR)
+set(USB_PROCESS_LIBS USB_LIBRARY)
+libfind_process(USB)