windows: copy libusb.dll to bin install dir (windows needs it to be alongside the exe or in the path) (Thanks to Gleen Ergeerts)

This commit is contained in:
Romuald Conty 2011-04-08 14:11:42 +00:00
parent ef92fc6a7b
commit 494e0f4474
2 changed files with 6 additions and 15 deletions

View file

@ -4,8 +4,8 @@
# Operating Systems Supported:
# - Unix (requires pkg-config)
# Tested with Ubuntu 9.04 and Fedora 11
# - Windows (requires MSVC)
# Tested with Windows XP
# - Windows (requires MinGW)
# Tested with Windows XP/Windows 7
#
# This should work for both 32 bit and 64 bit systems.
#
@ -26,20 +26,9 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
IF(NOT LIBUSB_FOUND)
IF(WIN32)
# Windows with Microsoft Visual C++
FIND_PATH(LIBUSB_INCLUDE_DIRS usb.h "$ENV{ProgramFiles}/LibUSB-Win32/include" NO_SYSTEM_ENVIRONMENT_PATH)
IF(MSVC)
IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x64")
# on x64 (win64)
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb PATHS "$ENV{ProgramFiles}/LibUSB-Win32/lib/msvc_x64")
ELSE(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x64")
# on x86 (win32)
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb PATHS "$ENV{ProgramFiles}/LibUSB-Win32/lib/msvc")
ENDIF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x64")
ENDIF(MSVC)
IF(MINGW)
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb PATHS "$ENV{ProgramFiles}/LibUSB-Win32/lib/gcc")
ENDIF(MINGW)
FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb PATHS "$ENV{ProgramFiles}/LibUSB-Win32/lib/gcc")
SET(LIBUSB_DLL "$ENV{ProgramFiles}/LibUSB-Win32/bin/x86/libusb0_x86.dll")
ELSE(WIN32)
# If not under Windows we use PkgConfig
FIND_PACKAGE (PkgConfig)

View file

@ -34,6 +34,8 @@ IF(WIN32)
# At compile time we need the .LIB file, we place it in the lib directory
INSTALL(TARGETS nfc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT headers)
INSTALL(FILES ${LIBUSB_DLL} DESTINATION bin COMPONENT examples RENAME "libusb0.dll")
ELSE(WIN32)
INSTALL(TARGETS nfc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
ENDIF(WIN32)