summaryrefslogtreecommitdiffstats
path: root/usbmuxd/FindUSB.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'usbmuxd/FindUSB.cmake')
-rw-r--r--usbmuxd/FindUSB.cmake68
1 files changed, 68 insertions, 0 deletions
diff --git a/usbmuxd/FindUSB.cmake b/usbmuxd/FindUSB.cmake
new file mode 100644
index 0000000..e81d51e
--- /dev/null
+++ b/usbmuxd/FindUSB.cmake
@@ -0,0 +1,68 @@
1# - Try to find USB
2# Once done this will define
3#
4# USB_FOUND - system has USB
5# USB_INCLUDE_DIRS - the USB include directory
6# USB_LIBRARIES - Link these to use USB
7# USB_DEFINITIONS - Compiler switches required for using USB
8#
9# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
10# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
11#
12# Redistribution and use is allowed according to the terms of the New
13# BSD license.
14# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15#
16
17
18if (USB_LIBRARIES AND USB_INCLUDE_DIRS)
19 # in cache already
20 set(USB_FOUND TRUE)
21else (USB_LIBRARIES AND USB_INCLUDE_DIRS)
22 find_path(USB_INCLUDE_DIR
23 NAMES
24 usb.h
25 PATHS
26 /usr/include
27 /usr/local/include
28 /opt/local/include
29 /sw/include
30 )
31
32 find_library(USB_LIBRARY
33 NAMES
34 usb
35 PATHS
36 /usr/lib
37 /usr/local/lib
38 /opt/local/lib
39 /sw/lib
40 )
41
42 set(USB_INCLUDE_DIRS
43 ${USB_INCLUDE_DIR}
44 )
45 set(USB_LIBRARIES
46 ${USB_LIBRARY}
47)
48
49 if (USB_INCLUDE_DIRS AND USB_LIBRARIES)
50 set(USB_FOUND TRUE)
51 endif (USB_INCLUDE_DIRS AND USB_LIBRARIES)
52
53 if (USB_FOUND)
54 if (NOT USB_FIND_QUIETLY)
55 message(STATUS "Found USB: ${USB_LIBRARIES}")
56 endif (NOT USB_FIND_QUIETLY)
57 else (USB_FOUND)
58 if (USB_FIND_REQUIRED)
59 message(FATAL_ERROR "Could not find USB")
60 endif (USB_FIND_REQUIRED)
61 endif (USB_FOUND)
62
63 # show the USB_INCLUDE_DIRS and USB_LIBRARIES variables only in the advanced view
64 mark_as_advanced(USB_INCLUDE_DIRS USB_LIBRARIES)
65
66endif (USB_LIBRARIES AND USB_INCLUDE_DIRS)
67
68