FindLIBUSB.cmake 1.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
# - Try to find LIBUSB
# Once done this will define
#  LIBUSB_FOUND          - System has LIBUSB
#  LIBUSB_INCLUDE_DIRS   - The LIBUSB include directories
#  LIBUSB_COMPILER_FLAGS - Compiler flags that are necessary for LIBUSB

if (LIBUSB_INCLUDE_DIR)
  # in cache already
  set(LIBUSB_FOUND TRUE)
  set(LIBUSB_INCLUDE_DIRS "${LIBUSB_INCLUDE_DIR}" )
else (LIBUSB_INCLUDE_DIR)

find_path( LIBUSB_INCLUDE_DIR 
           NAMES usb.h
           PATHS $ENV{LIBUSB_DIR}
                 /usr/include
          )

find_library( LIBUSB_LIBRARY
              usb
              PATHS /usr/lib/ 
              )

          
set(LIBUSB_INCLUDE_DIRS "${LIBUSB_INCLUDE_DIR}" )
set(LIBUSB_LIBRARIES "${LIBUSB_LIBRARY}" )


include(FindPackageHandleStandardArgs)

# handle the QUIETLY and REQUIRED arguments and set LIBUSB_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LIBUSB  DEFAULT_MSG
                                  LIBUSB_INCLUDE_DIR LIBUSB_LIBRARY)

mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARY)

endif(LIBUSB_INCLUDE_DIR)