Blame cmake/Findlibusb-1.0.cmake

Packit Service fa4841
# - Try to find libusb-1.0
Packit Service fa4841
# Once done this will define
Packit Service fa4841
#
Packit Service fa4841
# LIBUSB_1_FOUND - system has libusb
Packit Service fa4841
# LIBUSB_1_INCLUDE_DIRS - the libusb include directory
Packit Service fa4841
# LIBUSB_1_LIBRARIES - Link these to use libusb
Packit Service fa4841
# LIBUSB_1_DEFINITIONS - Compiler switches required for using libusb
Packit Service fa4841
#
Packit Service fa4841
# Adapted from cmake-modules Google Code project
Packit Service fa4841
#
Packit Service fa4841
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
Packit Service fa4841
#
Packit Service fa4841
# (Changes for libusb) Copyright (c) 2008 Kyle Machulis <kyle@nonpolynomial.com>
Packit Service fa4841
#
Packit Service fa4841
# Redistribution and use is allowed according to the terms of the New BSD license.
Packit Service fa4841
#
Packit Service fa4841
# CMake-Modules Project New BSD License
Packit Service fa4841
#
Packit Service fa4841
# Redistribution and use in source and binary forms, with or without
Packit Service fa4841
# modification, are permitted provided that the following conditions are met:
Packit Service fa4841
#
Packit Service fa4841
# * Redistributions of source code must retain the above copyright notice, this
Packit Service fa4841
# list of conditions and the following disclaimer.
Packit Service fa4841
#
Packit Service fa4841
# * Redistributions in binary form must reproduce the above copyright notice,
Packit Service fa4841
# this list of conditions and the following disclaimer in the
Packit Service fa4841
# documentation and/or other materials provided with the distribution.
Packit Service fa4841
#
Packit Service fa4841
# * Neither the name of the CMake-Modules Project nor the names of its
Packit Service fa4841
# contributors may be used to endorse or promote products derived from this
Packit Service fa4841
# software without specific prior written permission.
Packit Service fa4841
#
Packit Service fa4841
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
Packit Service fa4841
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Packit Service fa4841
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Packit Service fa4841
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
Packit Service fa4841
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Packit Service fa4841
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Packit Service fa4841
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
Packit Service fa4841
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit Service fa4841
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Packit Service fa4841
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service fa4841
#
Packit Service fa4841
Packit Service fa4841
Packit Service fa4841
if (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
Packit Service fa4841
  # in cache already
Packit Service fa4841
  set(LIBUSB_FOUND TRUE)
Packit Service fa4841
else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
Packit Service fa4841
  find_path(LIBUSB_1_INCLUDE_DIR
Packit Service fa4841
    NAMES
Packit Service b1ea74
      libusb.h
Packit Service fa4841
    PATHS
Packit Service fa4841
      /usr/include
Packit Service fa4841
      /usr/local/include
Packit Service fa4841
      /sw/include
Packit Service b1ea74
    PATH_SUFFIXES
Packit Service b1ea74
      libusb-1.0
Packit Service fa4841
  )
Packit Service fa4841
Packit Service fa4841
  find_library(LIBUSB_1_LIBRARY
Packit Service fa4841
    NAMES
Packit Service b1ea74
      libusb-1.0
Packit Service b1ea74
      usb-1.0
Packit Service b1ea74
      usb
Packit Service fa4841
    PATHS
Packit Service fa4841
      /usr/lib
Packit Service fa4841
      /usr/local/lib
Packit Service fa4841
      /sw/lib
Packit Service fa4841
  )
Packit Service fa4841
Packit Service fa4841
  set(LIBUSB_1_INCLUDE_DIRS
Packit Service fa4841
    ${LIBUSB_1_INCLUDE_DIR}
Packit Service fa4841
  )
Packit Service fa4841
  set(LIBUSB_1_LIBRARIES
Packit Service fa4841
    ${LIBUSB_1_LIBRARY}
Packit Service fa4841
)
Packit Service fa4841
Packit Service fa4841
  if (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
Packit Service fa4841
     set(LIBUSB_1_FOUND TRUE)
Packit Service fa4841
  endif (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
Packit Service fa4841
Packit Service fa4841
  if (LIBUSB_1_FOUND)
Packit Service fa4841
    if (NOT libusb_1_FIND_QUIETLY)
Packit Service fa4841
      message(STATUS "Found libusb-1.0:")
Packit Service b1ea74
      message(STATUS " - Includes: ${LIBUSB_1_INCLUDE_DIRS}")
Packit Service b1ea74
      message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}")
Packit Service fa4841
    endif (NOT libusb_1_FIND_QUIETLY)
Packit Service fa4841
  else (LIBUSB_1_FOUND)
Packit Service fa4841
    if (libusb_1_FIND_REQUIRED)
Packit Service fa4841
      message(FATAL_ERROR "Could not find libusb")
Packit Service fa4841
    endif (libusb_1_FIND_REQUIRED)
Packit Service fa4841
  endif (LIBUSB_1_FOUND)
Packit Service fa4841
Packit Service fa4841
  # show the LIBUSB_1_INCLUDE_DIRS and LIBUSB_1_LIBRARIES variables only in the advanced view
Packit Service fa4841
  mark_as_advanced(LIBUSB_1_INCLUDE_DIRS LIBUSB_1_LIBRARIES)
Packit Service fa4841
Packit Service fa4841
endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)