libftdi Archives

Subject: [PATCH] ftdi_eeprom: fix static build

From: yegorslists@xxxxxxxxxxxxxx
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: thomas.jarosch@xxxxxxxxxxxxx, Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx>
Date: Fri, 13 Jun 2025 09:52:11 +0200
From: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx>

Link to ftdi1-static if only STATICLIBS is enabled.
---
 ftdi_eeprom/CMakeLists.txt | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/ftdi_eeprom/CMakeLists.txt b/ftdi_eeprom/CMakeLists.txt
index 3958b66..4b21620 100644
--- a/ftdi_eeprom/CMakeLists.txt
+++ b/ftdi_eeprom/CMakeLists.txt
@@ -4,11 +4,11 @@ find_package(Libintl)
 # determine docdir
 include(GNUInstallDirs)
 if (NOT CMAKE_INSTALL_DOCDIR)
-    if (WIN32)
-        set(CMAKE_INSTALL_DOCDIR .)
-    else (WIN32)
-        set(CMAKE_INSTALL_DOCDIR 
${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME})
-    endif (WIN32)
+  if (WIN32)
+    set(CMAKE_INSTALL_DOCDIR .)
+  else (WIN32)
+    set(CMAKE_INSTALL_DOCDIR ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME})
+  endif (WIN32)
 endif (NOT CMAKE_INSTALL_DOCDIR)
 
 message(STATUS "Building ftdi_eeprom")
@@ -17,8 +17,8 @@ include_directories(${CONFUSE_INCLUDE_DIRS})
 list(APPEND libs ${CONFUSE_LIBRARIES})
 
 if (LIBINTL_FOUND)
-    include_directories(${LIBINTL_INCLUDE_DIR})
-    list(APPEND libs ${LIBINTL_LIBRARIES})
+  include_directories(${LIBINTL_INCLUDE_DIR})
+  list(APPEND libs ${LIBINTL_LIBRARIES})
 endif ()
 
 
@@ -36,12 +36,17 @@ configure_file(
 )
 
 add_executable(ftdi_eeprom main.c)
-target_link_libraries(ftdi_eeprom ftdi1 ${CONFUSE_LIBRARIES})
+if (NOT SHAREDLIBS AND STATICLIBS)
+  target_link_libraries(ftdi_eeprom ftdi1-static)
+else()
+  target_link_libraries(ftdi_eeprom ftdi1)
+endif()
+target_link_libraries(ftdi_eeprom ${CONFUSE_LIBRARIES})
 if (LIBINTL_FOUND)
-    target_link_libraries(ftdi_eeprom ${LIBINTL_LIBRARIES})
+  target_link_libraries(ftdi_eeprom ${LIBINTL_LIBRARIES})
 endif ()
 if (NOT SHAREDLIBS AND STATICLIBS)
-    target_link_libraries(ftdi_eeprom ${LIBUSB_LIBRARIES})
+  target_link_libraries(ftdi_eeprom ${LIBUSB_LIBRARIES})
 endif ()
 install(TARGETS ftdi_eeprom DESTINATION bin)
 install(FILES example.conf DESTINATION ${CMAKE_INSTALL_DOCDIR})
-- 
2.34.1


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread