Skip to content

Conversation

@ta7mid
Copy link

@ta7mid ta7mid commented Jan 3, 2026

This PR addresses the following issues encountered/noted when creating a Homebrew formula for reflect-cpp:

  • Building with libbson ≥2.0.0 fails as the names of their CMake config package and imported targets were changed.
  • In CMakeLists.txt, reflect-cpp links with arrow::arrow when REFLECTCPP_USE_VCPKG is false, but no such target is provided by the CMake config packages installed with Apache Arrow ≥21.0.0, regardless of whether vcpkg is used.
  • Generator expressions used to specify interface link libraries (as in target_link_libraries(reflectcpp PUBLIC $<IF:$<TARGET_EXISTS:…>…,…>) are not evaluated and get copied verbatim into the exported reflectcpp-exports.cmake.
  • It seems appropriate to link with shared versions of libbson and Arrow when building reflect-cpp as a shared library.

@gemini-code-assist
Copy link

Summary of Changes

Hello @ta7mid, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the CMake build system for reflect-cpp to enhance compatibility with updated versions of external dependencies, specifically libbson (2.0.0+) and Apache Arrow (21.0.0+). It addresses breaking changes in how these libraries expose their CMake packages and targets, ensuring reflect-cpp can correctly find and link against them. The changes also streamline the selection between static and shared library linkage based on the project's build type, improving overall build robustness.

Highlights

  • libbson CMake compatibility: Updated CMake configuration to correctly identify and link with libbson versions 2.0.0 and newer, which introduced changes to their package and target names. This includes conditional logic for vcpkg usage and explicit static/shared linkage.
  • Apache Arrow CMake targets: Adjusted the linking strategy for Apache Arrow to explicitly use Arrow::arrow_static or Arrow::arrow_shared targets, resolving issues with the arrow::arrow target no longer being provided in newer Arrow versions (>= 21.0.0).
  • Shared library linkage preference: Implemented logic to prioritize linking against shared versions of libbson and Apache Arrow when reflect-cpp is configured to build as a shared library, ensuring consistent build behavior.
  • vcpkg Arrow configuration: Modified vcpkg.json to disable default features for the arrow dependency, providing more precise control over its build configuration and preventing potential conflicts.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses several issues with dependency handling in CMake for libbson and Apache Arrow. The changes correctly adapt to new package and target names in recent versions of these libraries and simplify the logic for linking static or shared variants. My main concern is with the version range specified for libbson, which is too restrictive and would prevent using versions newer than 2.0.0. I've left specific suggestions to address this in the code.

@ta7mid ta7mid changed the title fix: CMake package/target names for libbson and Apache Arrow fix: CMake package and imported library target names Jan 3, 2026
@liuzicheng1987
Copy link
Contributor

@ta7mid thanks for the PR.

However, it appears that this has broken the Conan build. Could you take another look?

@ta7mid
Copy link
Author

ta7mid commented Jan 7, 2026

@liuzicheng1987 Can you check if it works now?

@liuzicheng1987
Copy link
Contributor

@ta7mid , there still appear to be the same issue with Conan...

@ta7mid
Copy link
Author

ta7mid commented Jan 8, 2026

It's probably fixed now.

use the `NAMES` kwarg with `find_package` to handle varying package names more robustly
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