From 736fd1b85cc0a187de78567621a8adfa1d1087c9 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 11 Jun 2026 09:57:11 +0200 Subject: [PATCH] cmake: Remove some Boost dependencies With the most recent changes, Boost.Thread and all Boost date/time libraries are no longer required. This updates the CMake and Debian files to reflect those changes. --- host/CMakeLists.txt | 7 +++---- host/cmake/Modules/UHDBoost.cmake | 9 +++++++++ host/cmake/debian/control | 2 -- host/lib/CMakeLists.txt | 6 ------ mpm/CMakeLists.txt | 2 -- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 7b4b5e701..1964fdadb 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -316,14 +316,13 @@ message(STATUS "Configuring Boost C++ Libraries...") # NO optional Boost components! # ALL required Boost components! set(UHD_BOOST_REQUIRED_COMPONENTS - chrono - date_time filesystem + # Only used by utils and examples, not libuhd: program_options + # Only used by nirio driver inside libuhd: serialization #system Boost.System is used, but explicitly listing it causes errors on some systems. - thread - #unit_test_framework Boost.Test is used, but listing it here causes problems when + #unit_test_framework Boost.Test is used, but listing it here causes problems when # using static linking (the Windows default). # Package detection for 'Boost::unit_test_framework' is handled # separately in UHDBoost.cmake to work around this issue. diff --git a/host/cmake/Modules/UHDBoost.cmake b/host/cmake/Modules/UHDBoost.cmake index d2fe6ced1..08d46f78a 100644 --- a/host/cmake/Modules/UHDBoost.cmake +++ b/host/cmake/Modules/UHDBoost.cmake @@ -242,6 +242,15 @@ else() message(STATUS "Looking for Boost version ${UHD_BOOST_MIN_VERSION} or greater - not found") endif() +# Prefer the modern header-only Boost imported target when available, but keep +# the legacy alias for older FindBoost/CMake combinations. +if(TARGET Boost::headers AND NOT TARGET Boost::boost) + add_library(Boost::boost INTERFACE IMPORTED) + set_target_properties(Boost::boost PROPERTIES + INTERFACE_LINK_LIBRARIES Boost::headers + ) +endif() + # unset some internal variables, if set unset(Boost_LIBRARY_DIR) unset(Boost_INCLUDE_DIR) diff --git a/host/cmake/debian/control b/host/cmake/debian/control index 216903c8e..4c92490c0 100644 --- a/host/cmake/debian/control +++ b/host/cmake/debian/control @@ -5,14 +5,12 @@ Maintainer: Ettus Research Uploaders: Joerg Hofrichter Build-Depends: cmake, debhelper (>= 12), - libboost-date-time-dev, libboost-dev, libboost-filesystem-dev, libboost-program-options-dev, libboost-serialization-dev, libboost-system-dev, libboost-test-dev, - libboost-thread-dev, libncurses-dev, libusb-1.0-0-dev [linux-any hurd-i386], libusb2-dev [kfreebsd-any], diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index e7acd52bf..e04882cc6 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -187,11 +187,8 @@ endif(DEFINED UHD_BOOST_REQUIRED_ADDITIONAL_WINDOWS_COMPONENTS) target_link_libraries(uhd PUBLIC Boost::boost - Boost::chrono - Boost::date_time Boost::filesystem Boost::serialization - Boost::thread ${libuhd_boost_msvc_libs} ${libuhd_libs} PRIVATE uhd_rc @@ -291,12 +288,9 @@ function(UHD_ADD_STATIC_LIB) target_link_libraries(uhd_static PUBLIC Boost::boost - Boost::chrono - Boost::date_time Boost::filesystem Boost::serialization Boost::system - Boost::thread ${libuhd_boost_msvc_libs} ) target_include_directories(uhd_static diff --git a/mpm/CMakeLists.txt b/mpm/CMakeLists.txt index bea55d8c5..0d989dcf4 100644 --- a/mpm/CMakeLists.txt +++ b/mpm/CMakeLists.txt @@ -83,8 +83,6 @@ message(STATUS "") message(STATUS "Configuring Boost C++ Libraries...") set(BOOST_REQUIRED_COMPONENTS system - thread - date_time ) # Same as with Python version: MPM might work with other versions of Boost, # but we don't make any guarantees.