mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2025-06-25 12:47:50 +02:00
lib/cmake: check for libusb_handle_events_timeout_completed()
libusb < 1.0.9 doesn't have libusb_handle_events_timeout_completed(), but libusb <= 1.0.8 doesn't have version.h, so we need to check for the function. The cmake-code was borrowed from UHD, which also checks for libusb_error_name(), we add that as well since it might come handy later on. Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
@ -24,6 +24,24 @@ endif()
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
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)
|
||||
add_definitions(-DHAVE_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)
|
||||
add_definitions(-DHAVE_LIBUSB_ERROR_NAME=1)
|
||||
endif(HAVE_LIBUSB_ERROR_NAME)
|
||||
|
||||
if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
|
||||
|
Reference in New Issue
Block a user