diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 9091c34ba1..66769f8197 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -91,6 +91,10 @@ if(CMAKE_SYSTEM MATCHES "DragonFly|FreeBSD") # Always use system libusb as reference implementation isn't supported add_library(usb-1.0-static INTERFACE) target_link_libraries(usb-1.0-static INTERFACE usb) +elseif(MSVC) + # Windows time.h defines timespec but doesn't add any flag for it, which makes libusb attempt to define it again + add_definitions(-DHAVE_STRUCT_TIMESPEC=1) + add_subdirectory(libusb EXCLUDE_FROM_ALL) else() add_subdirectory(libusb EXCLUDE_FROM_ALL) endif()