Debian Codegraph @

cmake_modules/FindUSB.cmake

raw
1 # - Try to find USB
2 # Once done this will define
3 #
4 # USB_FOUND - system has USB
5 # USB_INCLUDE_DIR - the USB include directory
6 # USB_LIBRARIES - Link these to use USB
7 # USB_VERSION_STRING - Human readable version number of cfitsio
8 # USB_VERSION_MAJOR - Major version number of cfitsio
9 # USB_VERSION_MINOR - Minor version number of cfitsio
10
11 # Copyright (c) 2006, Jasem Mutlaq <[email protected]>
12 # Based on FindLibfacile by Carsten Niehaus, <[email protected]>
13 #
14 # Redistribution and use is allowed according to the terms of the BSD license.
15 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
16
17 if (USB_INCLUDE_DIR AND USB_LIBRARIES)
18
19 # in cache already
20 set(USB_FOUND TRUE)
21 message(STATUS "Found USB: ${USB_LIBRARIES}")
22
23
24 else (USB_INCLUDE_DIR AND USB_LIBRARIES)
25
26 # JM: Packages from different distributions have different suffixes
27 find_path(USB_INCLUDE_DIR libusb.h
28 PATH_SUFFIXES libusb-1.0
29 ${_obIncDir}
30 ${GNUWIN32_DIR}/include
31 )
32
33 find_library(USB_LIBRARIES NAMES usb-1.0
34 PATHS
35 ${_obLinkDir}
36 ${GNUWIN32_DIR}/lib
37 HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}
38 )
39
40 if(USB_INCLUDE_DIR AND USB_LIBRARIES)
41 set(USB_FOUND TRUE)
42 else (USB_INCLUDE_DIR AND USB_LIBRARIES)
43 set(USB_FOUND FALSE)
44 endif(USB_INCLUDE_DIR AND USB_LIBRARIES)
45
46
47 if (USB_FOUND)
48
49 if (NOT USB_FIND_QUIETLY)
50 message(STATUS "Found USB ${USB_VERSION_STRING}: ${USB_LIBRARIES}")
51 endif (NOT USB_FIND_QUIETLY)
52 else (USB_FOUND)
53 if (USB_FIND_REQUIRED)
54 message(STATUS "USB not found.")
55 endif (USB_FIND_REQUIRED)
56 endif (USB_FOUND)
57
58 mark_as_advanced(USB_INCLUDE_DIR USB_LIBRARIES)
59
60 endif (USB_INCLUDE_DIR AND USB_LIBRARIES)