CMakeLists.txt: Fix last piece to compile static on windows
@@ -58,7 +58,7 @@ set(STLINK_SOURCE
)
if (WIN32 OR MSYS OR MINGW)
- set (STLINK_SOURCE "${STLINK_SOURCE};src/mmap.c;src/mingw/mingw.c") # TODO
+ set (STLINK_SOURCE "${STLINK_SOURCE};src/mmap.c;src/mingw/mingw.c")
endif ()
include_directories(${LIBUSB_INCLUDE_DIR})
@@ -96,7 +96,6 @@ if (APPLE)
target_link_libraries(${STLINK_LIB_SHARED} ${CoreFoundation} ${IOKit} ${ObjC})
endif()
-# Link
if (WIN32 OR MSYS OR MINGW)
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} wsock32 ws2_32)
else()
@@ -117,8 +116,6 @@ add_library(${STLINK_LIB_STATIC} STATIC
${STLINK_SOURCE}
)
-target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY})
-
# Link shared library with apple OS libraries
if (APPLE)
find_library(ObjC objc)
@@ -127,6 +124,12 @@ if (APPLE)
target_link_libraries(${STLINK_LIB_STATIC} ${CoreFoundation} ${IOKit} ${ObjC})
endif()
+if (WIN32 OR MSYS OR MINGW)
+ target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} wsock32 ws2_32)
+else()
+ target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY})
+endif()
+
set_target_properties(${STLINK_LIB_STATIC} PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
install(TARGETS ${STLINK_LIB_STATIC}
