libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v1.5-67-g4f600d6

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 31 Dec 2025 17:07:00 +0100 (CET)
The branch, master has been updated
       via  4f600d690ee0dcbecef4b02edb5700fe84c4a9b3 (commit)
      from  f7ed9dd371f9387ed5b715a4f316eea9f85de48d (commit)


- Log -----------------------------------------------------------------
commit 4f600d690ee0dcbecef4b02edb5700fe84c4a9b3
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date:   Wed Dec 31 16:02:00 2025 +0100

    Modernize Boost detection for CMake 3.30+
    
    Add CMP0167 policy for CMake 3.30+ to suppress FindBoost deprecation 
warning.
    Use modern Boost imported targets when available (CMake 3.30+).
    
    Fall back to old-style variables for backward compatibility.
    
    Move detection of "Boost" to test/CMakeLists.txt only.
    
    Tested with:
    
    cmake version   gcc version   Boost version
    3.31.6 (F42)    15.2.1        1.83.0
    3.28.2          4.4.4         1.44.0
    3.28.2          8.3.1         1.76.0

-----------------------------------------------------------------------

Summary of changes:
 CMakeLists.txt      |    5 -----
 test/CMakeLists.txt |   29 +++++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 105f83a..9519a09 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,11 +46,6 @@ endif (${CMAKE_BUILD_TYPE} STREQUAL Debug)
 find_package(LibUSB REQUIRED)
 include_directories(${LIBUSB_INCLUDE_DIR})
 
-# Find Boost
-if (BUILD_TESTS)
-    find_package(Boost REQUIRED)
-endif ()
-
 # Set components
 set(CPACK_COMPONENTS_ALL sharedlibs staticlibs headers)
 set(CPACK_COMPONENT_SHAREDLIBS_DISPLAY_NAME "Shared libraries")
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c44c614..2ba4206 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,13 +1,38 @@
+# Unit tests only: Modern Boost integration (CMake 3.30+)
+# Use CMake's built-in Boost support instead of deprecated FindBoost module
+# For CMake < 3.30, keep old behavior to avoid errors
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)
+    cmake_policy(SET CMP0167 NEW)
+endif ()
+
+# Make CMake respect variables like BOOST_ROOT even though we look for "Boost"
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.27)
+    cmake_policy(SET CMP0144 NEW)
+endif ()
+
+# Find Boost unit test framework. We don't want to link that to libftdi1 
itself.
 find_package(Boost COMPONENTS unit_test_framework REQUIRED)
 
 enable_testing()
 
-INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/src ${Boost_INCLUDE_DIRS})
+# CMake 3.28 compatibility: include_directories only needed for CMake < 3.30
+# (imported targets handle include paths automatically in CMake 3.30+)
+if (CMAKE_VERSION VERSION_LESS 3.30)
+    INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
+endif ()
+
+INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/src)
 
 set(cpp_tests basic.cpp baudrate.cpp)
 
 add_executable(test_libftdi1 ${cpp_tests})
-target_link_libraries(test_libftdi1 ftdi1 
${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
+
+# Use modern imported targets for CMake 3.30+, fallback to old-style variables
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)
+    target_link_libraries(test_libftdi1 ftdi1 Boost::unit_test_framework)
+else ()
+    target_link_libraries(test_libftdi1 ftdi1 
${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
+endif ()
 
 add_test(test_libftdi1 test_libftdi1)
 


hooks/post-receive
-- 
A library to talk to FTDI chips

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

Current Thread
  • A library to talk to FTDI chips branch, master, updated. v1.5-67-g4f600d6, libftdi-git <=