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.cmake17
1 files changed, 15 insertions, 2 deletions
diff --git a/host/cmake/Modules/FindUSB1.cmake b/host/cmake/Modules/FindUSB1.cmake
index 8bfc2f975..a1ab4ca90 100644
--- a/host/cmake/Modules/FindUSB1.cmake
+++ b/host/cmake/Modules/FindUSB1.cmake
@@ -22,7 +22,7 @@ FIND_PATH(LIBUSB_INCLUDE_DIRS
set(libusb1_library_names usb-1.0)
#libusb-1.0 compatible library on freebsd
-if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+if((CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") OR (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD"))
list(APPEND libusb1_library_names usb)
endif()
@@ -32,7 +32,20 @@ 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)
+
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES)
-