1 # - Try to find USB-1.0
2 # Once done this will define
4 # USB-1.0_FOUND - system has USB-1.0
5 # USB-1.0_INCLUDE_DIRS - the USB-1.0 include directory
6 # USB-1.0_LIBRARIES - Link these to use USB-1.0
7 # USB-1.0_DEFINITIONS - Compiler switches required for using USB-1.0
9 # Copyright (c) 2009 Andreas Schneider <mail@cynapses.org>
11 # Redistribution and use is allowed according to the terms of the New
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
17 if (USB-1.0_LIBRARIES AND USB-1.0_INCLUDE_DIRS)
19 set(USB-1.0_FOUND TRUE)
20 else (USB-1.0_LIBRARIES AND USB-1.0_INCLUDE_DIRS)
21 # use pkg-config to get the directories and then use these values
22 # in the FIND_PATH() and FIND_LIBRARY() calls
23 if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
25 pkgconfig(libusb-1.0 _USB-1.0_INCLUDEDIR _USB-1.0_LIBDIR _USB-1.0_LDFLAGS _USB-1.0_CFLAGS)
26 else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
27 find_package(PkgConfig)
29 pkg_check_modules(_USB-1.0 libusb-1.0)
30 endif (PKG_CONFIG_FOUND)
31 endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
33 find_path(USB-1.0_INCLUDE_DIR
37 ${_USB-1.0_INCLUDEDIR}
45 mark_as_advanced(USB-1.0_INCLUDE_DIR)
47 find_library(USB-1.0_LIBRARY
57 mark_as_advanced(USB-1.0_LIBRARY)
60 set(USB-1.0_FOUND TRUE)
61 mark_as_advanced(USB-1.0_FOUND)
62 endif (USB-1.0_LIBRARY)
64 set(USB-1.0_INCLUDE_DIRS
65 ${USB-1.0_INCLUDE_DIR}
75 if (USB-1.0_INCLUDE_DIRS AND USB-1.0_LIBRARIES)
76 set(USB-1.0_FOUND TRUE)
77 endif (USB-1.0_INCLUDE_DIRS AND USB-1.0_LIBRARIES)
80 if (NOT USB-1.0_FIND_QUIETLY)
81 message(STATUS "Found USB-1.0: ${USB-1.0_LIBRARIES}")
82 endif (NOT USB-1.0_FIND_QUIETLY)
84 if (USB-1.0_FIND_REQUIRED)
85 message(FATAL_ERROR "Could not find USB-1.0")
86 endif (USB-1.0_FIND_REQUIRED)
89 # show the USB-1.0_INCLUDE_DIRS and USB-1.0_LIBRARIES variables only in the advanced view
90 mark_as_advanced(USB-1.0_INCLUDE_DIRS USB-1.0_LIBRARIES)
92 endif (USB-1.0_LIBRARIES AND USB-1.0_INCLUDE_DIRS)