vcpkg/ports/libftdi1/win32.patch

29 lines
1.2 KiB
Diff
Raw Normal View History

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9fd86a6..e1e848c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -18,9 +18,14 @@ message(STATUS "Detected git snapshot version: ${SNAPSHOT_VERSION}")
configure_file(ftdi_version_i.h.in "${CMAKE_CURRENT_BINARY_DIR}/ftdi_version_i.h" @ONLY)
# Targets
+if(WIN32)
+set(c_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.c ${CMAKE_CURRENT_SOURCE_DIR}/exports.def CACHE INTERNAL "List of c sources" )
+else()
set(c_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.c ${CMAKE_CURRENT_SOURCE_DIR}/ftdi_stream.c CACHE INTERNAL "List of c sources" )
+endif()
set(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.h CACHE INTERNAL "List of c headers" )
+if(BUILD_SHARED_LIBS)
add_library(ftdi1 SHARED ${c_sources})
math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases
@@ -38,7 +43,7 @@ install ( TARGETS ftdi1
ARCHIVE DESTINATION lib${LIB_SUFFIX}
)
-if ( STATICLIBS )
+else()
add_library(ftdi1-static STATIC ${c_sources})
target_link_libraries(ftdi1-static ${LIBUSB_LIBRARIES})
set_target_properties(ftdi1-static PROPERTIES OUTPUT_NAME "ftdi1")