blob: 9ee570f5682a4eb376ae0bfa85a716ac20d723b1 [file] [log] [blame] [edit]
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -194,8 +194,10 @@
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} ${SSP_LIB})
endif ()
-install(TARGETS ${STLINK_LIB_SHARED} DESTINATION ${STLINK_LIBRARY_PATH})
-
+install(TARGETS ${STLINK_LIB_SHARED}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
###
# Static library
--- a/cmake/modules/c_flags.cmake
+++ b/cmake/modules/c_flags.cmake
@@ -50,5 +50,4 @@
add_cflag_if_supported("-O0")
else ()
add_cflag_if_supported("-O2")
- add_cflag_if_supported("-Werror")
endif ()
--- a/cmake/modules/Findlibusb.cmake
+++ b/cmake/modules/Findlibusb.cmake
@@ -54,9 +54,13 @@
endif ()
if (WIN32 AND NOT EXISTS "/etc/debian_version") # Skip this for Debian...
+ find_package(PkgConfig)
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(LIBUSB libusb-1.0)
+ endif()
FIND_PATH(
LIBUSB_INCLUDE_DIR NAMES libusb.h
- HINTS /usr /usr/local /opt
+ HINTS ${LIBUSB_INCLUDE_DIR}
PATH_SUFFIXES libusb-1.0
)
@@ -64,7 +68,7 @@
set(LIBUSB_NAME usb-1.0)
find_library(
LIBUSB_LIBRARY NAMES ${LIBUSB_NAME}
- HINTS ${LIBUSB_WIN_OUTPUT_FOLDER}/MinGW${ARCH}/static
+ HINTS ${LIBUSB_LIBRARY_DIR}
)
else (MSVC)
set(LIBUSB_NAME libusb-1.0.lib)
@@ -75,7 +79,10 @@
endif ()
endif ()
- if (NOT LIBUSB_FOUND)
+ if (LIBUSB_FOUND)
+ message(STATUS "=== LIBUSB_INCLUDE_DIR: " ${LIBUSB_INCLUDE_DIR})
+ message(STATUS "=== LIBUSB_LIBRARY: " ${LIBUSB_LIBRARY})
+ else ()
# Preparations for installing libusb library
set(LIBUSB_WIN_VERSION 1.0.23) # set libusb version
set(LIBUSB_WIN_ARCHIVE libusb-${LIBUSB_WIN_VERSION}.7z)