aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules/FindUSB1.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'host/cmake/Modules/FindUSB1.cmake')
-rw-r--r--host/cmake/Modules/FindUSB1.cmake20
1 files changed, 19 insertions, 1 deletions
diff --git a/host/cmake/Modules/FindUSB1.cmake b/host/cmake/Modules/FindUSB1.cmake
index 21005344b..a494e1350 100644
--- a/host/cmake/Modules/FindUSB1.cmake
+++ b/host/cmake/Modules/FindUSB1.cmake
@@ -32,7 +32,25 @@ FIND_LIBRARY(LIBUSB_LIBRARIES
PATHS /usr/local/lib /usr/lib /opt/local/lib
)
+enable_language(C) #needs C support for check below
+include(CheckFunctionExists)
+if(LIBUSB_INCLUDE_DIRS)
+ set(CMAKE_REQUIRED_INCLUDES ${LIBUSB_INCLUDE_DIRS})
+endif()
+if(LIBUSB_LIBRARIES)
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBUSB_LIBRARIES})
+endif()
+
+CHECK_FUNCTION_EXISTS("libusb_handle_events_timeout_completed" HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED)
+if(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED)
+ list(APPEND LIBUSB_DEFINITIONS "HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED=1")
+endif(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED)
+
+CHECK_FUNCTION_EXISTS("libusb_error_name" HAVE_LIBUSB_ERROR_NAME)
+if(HAVE_LIBUSB_ERROR_NAME)
+ list(APPEND LIBUSB_DEFINITIONS "HAVE_LIBUSB_ERROR_NAME=1")
+endif(HAVE_LIBUSB_ERROR_NAME)
+
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES)
-