CMake: bump the minimal required version to 3.5
[libftdi] / cmake / FindLibUSB.cmake
CommitLineData
161caf3d 1# - Try to find the libusb library
89a3169e
MK
2# Once done this defines
3#
4# LIBUSB_FOUND - system has libusb
5# LIBUSB_INCLUDE_DIR - the libusb include directory
6# LIBUSB_LIBRARIES - Link these to use libusb
7
8# Copyright (c) 2006, 2008 Laurent Montel, <montel@kde.org>
9#
10# Redistribution and use is allowed according to the terms of the BSD license.
11# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12
89a3169e
MK
13if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
14
15 # in cache already
16 set(LIBUSB_FOUND TRUE)
17
18else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
300a9ed7
PF
19 # use pkg-config to get the directories and then use these values
20 # in the FIND_PATH() and FIND_LIBRARY() calls
21 find_package(PkgConfig)
22 pkg_check_modules(PC_LIBUSB libusb-1.0)
89a3169e 23
161caf3d 24 find_path(LIBUSB_INCLUDE_DIR libusb.h
57fe941a 25 PATH_SUFFIXES libusb-1.0
89a3169e
MK
26 PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
27
ed8aad3c 28 find_library(LIBUSB_LIBRARIES NAMES ${PC_LIBUSB_LIBRARIES}
89a3169e
MK
29 PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
30
31 include(FindPackageHandleStandardArgs)
161caf3d
YY
32 find_package_handle_standard_args(
33 LibUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR
34 )
89a3169e 35
161caf3d 36 mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
89a3169e
MK
37
38endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)