Skip to content

Add find_dependency calls and use of correct targets to B2 generated CMake configs - #84

Merged
pdimov merged 1 commit into
boostorg:developfrom
Flamefire:find_dependency-b2
Oct 26, 2026
Merged

pdimov merged 1 commit into
boostorg:developfrom
Flamefire:find_dependency-b2

Conversation

@Flamefire

Copy link
Copy Markdown
Contributor

I replaced remap-library by a loop over the dependencies and collect required find_dependency calls, replacing names by targets where available.
For ICU the libraries need to be collected into a single target.

This also applies to shared builds as the targets need to be available.

Example output from installed config:

include(CMakeFindDependencyMacro)
find_dependency(ICU COMPONENTS data i18n uc)
if(CMAKE_CONFIGURATION_TYPES)
  set_property(TARGET Boost::locale APPEND PROPERTY INTERFACE_LINK_LIBRARIES
    "$<$<CONFIG:release>:ICU::data;ICU::i18n;ICU::uc;quadmath>")
else()
  set_property(TARGET Boost::locale APPEND PROPERTY INTERFACE_LINK_LIBRARIES
    ICU::data ICU::i18n ICU::uc quadmath)
endif()

Diff over a full build (static only) looks good:

diff -ur --exclude '*shared*' /tmp/boost-orig/lib/cmake/boost_iostreams-1.93.0/libboost_iostreams-variant-static.cmake /tmp/boost-new/lib/cmake/boost_iostreams-1.93.0/libboost_iostreams-variant-static.cmake
--- /tmp/boost-orig/lib/cmake/boost_iostreams-1.93.0/libboost_iostreams-variant-static.cmake	2026-10-26 13:59:30.915107891 +0100
+++ /tmp/boost-new/lib/cmake/boost_iostreams-1.93.0/libboost_iostreams-variant-static.cmake	2026-10-26 13:41:52.396043216 +0100
@@ -85,10 +85,13 @@
 
 list(APPEND _BOOST_IOSTREAMS_DEPS random headers)
 
+include(CMakeFindDependencyMacro)
+find_dependency(BZip2)
+find_dependency(ZLIB)
 if(CMAKE_CONFIGURATION_TYPES)
   set_property(TARGET Boost::iostreams APPEND PROPERTY INTERFACE_LINK_LIBRARIES
-    "$<$<CONFIG:release>:bz2;lzma;z>")
+    "$<$<CONFIG:release>:BZip2::BZip2;lzma;ZLIB::ZLIB>")
 else()
   set_property(TARGET Boost::iostreams APPEND PROPERTY INTERFACE_LINK_LIBRARIES
-    bz2 lzma z)
+    BZip2::BZip2 lzma ZLIB::ZLIB)
 endif()
diff -ur --exclude '*shared*' /tmp/boost-orig/lib/cmake/boost_locale-1.93.0/libboost_locale-variant-static.cmake /tmp/boost-new/lib/cmake/boost_locale-1.93.0/libboost_locale-variant-static.cmake
--- /tmp/boost-orig/lib/cmake/boost_locale-1.93.0/libboost_locale-variant-static.cmake	2026-10-26 13:59:30.809898787 +0100
+++ /tmp/boost-new/lib/cmake/boost_locale-1.93.0/libboost_locale-variant-static.cmake	2026-10-26 13:42:01.141616563 +0100
@@ -85,10 +85,12 @@
 
 list(APPEND _BOOST_LOCALE_DEPS atomic charconv chrono date_time exception thread headers)
 
+include(CMakeFindDependencyMacro)
+find_dependency(ICU COMPONENTS data i18n uc)
 if(CMAKE_CONFIGURATION_TYPES)
   set_property(TARGET Boost::locale APPEND PROPERTY INTERFACE_LINK_LIBRARIES
-    "$<$<CONFIG:release>:icudata;icui18n;icuuc;quadmath>")
+    "$<$<CONFIG:release>:ICU::data;ICU::i18n;ICU::uc;quadmath>")
 else()
   set_property(TARGET Boost::locale APPEND PROPERTY INTERFACE_LINK_LIBRARIES
-    icudata icui18n icuuc quadmath)
+    ICU::data ICU::i18n ICU::uc quadmath)
 endif()
diff -ur --exclude '*shared*' /tmp/boost-orig/lib/cmake/boost_regex_old-1.93.0/libboost_regex_old-variant-static.cmake /tmp/boost-new/lib/cmake/boost_regex_old-1.93.0/libboost_regex_old-variant-static.cmake
--- /tmp/boost-orig/lib/cmake/boost_regex_old-1.93.0/libboost_regex_old-variant-static.cmake	2026-10-26 13:59:31.011197179 +0100
+++ /tmp/boost-new/lib/cmake/boost_regex_old-1.93.0/libboost_regex_old-variant-static.cmake	2026-10-26 13:42:42.955957535 +0100
@@ -85,10 +85,12 @@
 
 list(APPEND _BOOST_REGEX_OLD_DEPS headers)
 
+include(CMakeFindDependencyMacro)
+find_dependency(ICU COMPONENTS data i18n uc)
 if(CMAKE_CONFIGURATION_TYPES)
   set_property(TARGET Boost::regex_old APPEND PROPERTY INTERFACE_LINK_LIBRARIES
-    "$<$<CONFIG:release>:icudata;icui18n;icuuc>")
+    "$<$<CONFIG:release>:ICU::data;ICU::i18n;ICU::uc>")
 else()
   set_property(TARGET Boost::regex_old APPEND PROPERTY INTERFACE_LINK_LIBRARIES
-    icudata icui18n icuuc)
+    ICU::data ICU::i18n ICU::uc)
 endif()

@pdimov

pdimov commented Oct 26, 2026

Copy link
Copy Markdown
Member

OK, let's give it a try.

@pdimov
pdimov merged commit 47fb1bd into boostorg:develop Oct 26, 2026
259 of 262 checks passed
@Flamefire
Flamefire deleted the find_dependency-b2 branch October 26, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants