From a7376266b3a9264c2e4249b6f3baf9d315cbecb6 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Fri, 20 Jan 2017 17:51:06 +0100 Subject: [PATCH] cmake: Fix libusb on Windows and make it static --- Externals/libusb/CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Externals/libusb/CMakeLists.txt b/Externals/libusb/CMakeLists.txt index fe8c236140..84754f1130 100644 --- a/Externals/libusb/CMakeLists.txt +++ b/Externals/libusb/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(usb SHARED EXCLUDE_FROM_ALL +add_library(usb STATIC EXCLUDE_FROM_ALL libusb/core.c libusb/core.c libusb/descriptor.c @@ -8,6 +8,9 @@ add_library(usb SHARED EXCLUDE_FROM_ALL libusb/sync.c ) set_target_properties(usb PROPERTIES VERSION 1.0.19) +if(WIN32) + target_include_directories(usb BEFORE PUBLIC libusb PRIVATE msvc) +else() target_include_directories(usb # turns out other projects also have "config.h", so make sure the # LibUSB one comes first @@ -16,9 +19,14 @@ target_include_directories(usb PUBLIC libusb PRIVATE "${CMAKE_CURRENT_BINARY_DIR}" ) +endif() if(WIN32 OR CYGWIN) - target_sources(usb PRIVATE libusb/os/windows_usb.c) + target_sources(usb PRIVATE + libusb/os/threads_windows.c + libusb/os/windows_winusb.c + libusb/os/windows_nt_common.c + ) set(OS_WINDOWS TRUE) elseif(APPLE) target_sources(usb PRIVATE libusb/os/darwin_usb.c)