From af86d1d77a4521fe27f6ab1c134eb88f65c1e6f6 Mon Sep 17 00:00:00 2001 From: msuih Date: Thu, 11 Apr 2019 15:23:49 +0300 Subject: [PATCH] Fix timespec for MSVC --- 3rdparty/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) 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()