vcpkg/ports/libftdi1/win32.patch
Sean Yen d1b4e88d3c [libftdi-compat] Add new port (#6843)
* [libftdi-compat] v0.20 port

* Fixed wrong version number in CONTROL file.

* Download source archive file instead.

* restrict to shared library build only.

* Remove dlls from static build.

* [libftdi-compat] Update to 1.4. Replace CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS with a def file. Minimize patching.

* [libftdi] Rename from libftdi-compat

* [libftdi][libftdi1] Restore v0.20 as libftdi, move 1.4 to libftdi1
2019-06-21 22:45:40 -07:00

29 lines
1.2 KiB
Diff

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")