Skip to content

Commit

Permalink
cmake: Fix libusb on Windows and make it static
Browse files Browse the repository at this point in the history
  • Loading branch information
Orphis committed Jan 20, 2017
1 parent 9e451d6 commit a737626
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Externals/libusb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit a737626

Please sign in to comment.