Please see the attached patches to allow reflect-cpp to build w/
libbson-dev v2. One can simply be applied directly on the HEAD of
master, and the other can be used to replace fix-cmake-deps.patch.

Regards,

-Roberto

-- 
Roberto C. Sánchez
>From 27cb9fa2a5c8ce1884e3587fdf7c92adcda6d30d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20C=2E=20S=C3=A1nchez?= <[email protected]>
Date: Thu, 28 Aug 2025 17:45:53 -0400
Subject: [PATCH] Fix FTBFS w/ libbson-dev >= 2.0 (Closes: #1112052)

---
 debian/changelog                    |  7 +++++++
 debian/patches/fix-cmake-deps.patch | 16 +++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d97ffb9..77837aa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+reflect-cpp (0.18.0+ds-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTBFS w/ libbson-dev >= 2.0 (Closes: #1112052)
+
+ -- Roberto C. Sánchez <[email protected]>  Thu, 28 Aug 2025 17:45:30 -0400
+
 reflect-cpp (0.18.0+ds-3) unstable; urgency=medium
 
   * d/{control,rules}: add B-D on libjsoncons-dev to support CBOR and UBJSON.
diff --git a/debian/patches/fix-cmake-deps.patch b/debian/patches/fix-cmake-deps.patch
index 4691de2..e58352d 100644
--- a/debian/patches/fix-cmake-deps.patch
+++ b/debian/patches/fix-cmake-deps.patch
@@ -5,6 +5,10 @@ Forwarded: not-needed
 Last-Update: 2025-02-12 
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+---
+ CMakeLists.txt |   37 ++++++++++++++++++++++---------------
+ 1 file changed, 22 insertions(+), 15 deletions(-)
+
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -88,16 +88,16 @@
@@ -39,7 +43,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
      if (REFLECTCPP_USE_VCPKG)
          target_include_directories(reflectcpp SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
          if (MSVC)
-@@ -137,27 +136,29 @@
+@@ -137,27 +136,35 @@
          pkg_check_modules(avro REQUIRED IMPORTED_TARGET avro-c)
          target_link_libraries(reflectcpp PUBLIC PkgConfig::avro)
      endif ()
@@ -51,11 +55,17 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
          src/reflectcpp_bson.cpp
      )
 -    if (NOT TARGET mongo::bson_static AND NOT TARGET mongo::bson_shared)
-+    if (NOT TARGET mongo::bson_shared)
++    if (NOT TARGET bson::shared)
++        find_package(bson 2.0 CONFIG)
++        if (bson_FOUND)
++            target_link_libraries(reflectcpp PUBLIC bson::shared)
++        endif ()
++    endif ()
++    if (NOT bson_FOUND AND NOT TARGET mongo::bson_shared)
          find_package(bson-1.0 CONFIG REQUIRED)
++        target_link_libraries(reflectcpp PUBLIC mongo::bson_shared)
      endif ()
 -    target_link_libraries(reflectcpp PUBLIC $<IF:$<TARGET_EXISTS:mongo::bson_static>,mongo::bson_static,mongo::bson_shared>)
-+    target_link_libraries(reflectcpp PUBLIC mongo::bson_shared)
  endif ()
  
  if (REFLECTCPP_CAPNPROTO)
-- 
2.39.5

Description: Fix cmake dependencies
 Use bundled ctre (not packaged now), use correct msgpack library name
Author: Shengqi Chen <[email protected]>
Forwarded: not-needed
Last-Update: 2025-02-12 
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---
 CMakeLists.txt |   37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,16 +88,16 @@
     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
     $<INSTALL_INTERFACE:include>)
 
-if (REFLECTCPP_USE_BUNDLED_DEPENDENCIES)
+#if (REFLECTCPP_USE_BUNDLED_DEPENDENCIES)
     target_include_directories(
         reflectcpp PUBLIC
         $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/rfl/thirdparty>)
-else ()
-    if (NOT TARGET ctre::ctre)
-        find_package(ctre CONFIG REQUIRED)
-    endif ()
-    target_link_libraries(reflectcpp PUBLIC ctre::ctre)
-endif ()
+#else ()
+#    if (NOT TARGET ctre::ctre)
+#        find_package(ctre CONFIG REQUIRED)
+#    endif ()
+#    target_link_libraries(reflectcpp PUBLIC ctre::ctre)
+#endif ()
 
 if (REFLECTCPP_JSON)
     list(APPEND REFLECT_CPP_SOURCES
@@ -124,7 +124,6 @@
     list(APPEND REFLECT_CPP_SOURCES
         src/reflectcpp_avro.cpp
     )
-    find_package(jansson CONFIG REQUIRED)
     if (REFLECTCPP_USE_VCPKG)
         target_include_directories(reflectcpp SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
         if (MSVC)
@@ -137,27 +136,35 @@
         pkg_check_modules(avro REQUIRED IMPORTED_TARGET avro-c)
         target_link_libraries(reflectcpp PUBLIC PkgConfig::avro)
     endif ()
-    target_link_libraries(reflectcpp PRIVATE jansson::jansson)
 endif ()
 
 if (REFLECTCPP_BSON)
     list(APPEND REFLECT_CPP_SOURCES
         src/reflectcpp_bson.cpp
     )
-    if (NOT TARGET mongo::bson_static AND NOT TARGET mongo::bson_shared)
+    if (NOT TARGET bson::shared)
+        find_package(bson 2.0 CONFIG)
+        if (bson_FOUND)
+            target_link_libraries(reflectcpp PUBLIC bson::shared)
+        endif ()
+    endif ()
+    if (NOT bson_FOUND AND NOT TARGET mongo::bson_shared)
         find_package(bson-1.0 CONFIG REQUIRED)
+        target_link_libraries(reflectcpp PUBLIC mongo::bson_shared)
     endif ()
-    target_link_libraries(reflectcpp PUBLIC $<IF:$<TARGET_EXISTS:mongo::bson_static>,mongo::bson_static,mongo::bson_shared>)
 endif ()
 
 if (REFLECTCPP_CAPNPROTO)
     list(APPEND REFLECT_CPP_SOURCES
         src/reflectcpp_capnproto.cpp
     )
-    if (NOT TARGET CapnProto)
-        find_package(CapnProto CONFIG REQUIRED)
-    endif ()
-     target_link_libraries(reflectcpp PUBLIC CapnProto::kj CapnProto::capnp CapnProto::capnpc CapnProto::kj-gzip)
+    # if (NOT TARGET CapnProto)
+        # find_package(CapnProto CONFIG REQUIRED) # see bug #1095942
+    # endif ()
+    # target_link_libraries(reflectcpp PUBLIC CapnProto::kj CapnProto::capnp CapnProto::capnpc CapnProto::kj-gzip)
+    find_package(PkgConfig REQUIRED)
+    pkg_check_modules(capnp REQUIRED IMPORTED_TARGET capnp kj capnpc kj-gzip)
+    target_link_libraries(reflectcpp PUBLIC PkgConfig::capnp)
 endif ()
 
 if (REFLECTCPP_CBOR)

Reply via email to