Skip to content

Comments

Support FetchContent, add_subdirectory, and standalone install#182

Merged
sgerbino merged 1 commit intocppalliance:developfrom
sgerbino:pr/cmake
Feb 23, 2026
Merged

Support FetchContent, add_subdirectory, and standalone install#182
sgerbino merged 1 commit intocppalliance:developfrom
sgerbino:pr/cmake

Conversation

@sgerbino
Copy link
Collaborator

@sgerbino sgerbino commented Feb 23, 2026

Use generator expressions for include directories so paths don't leak to consumers. Gate benchmarks and tests behind options that default to OFF for subdirectory builds. Add EXPORT_NAME so the imported target is Boost::capy across all consumption patterns. Provide boost_install() for superproject builds and a standalone install path with config/version files for find_package() support. Remove CMakePresets.json and ASCII section dividers.

Summary by CodeRabbit

  • Documentation

    • Updated build instructions with explicit Ninja-based configuration steps
    • Added guidance for integrating capy into projects via CMake FetchContent and add_subdirectory
  • Chores

    • Introduced configurable build options to control test and benchmark compilation
    • Removed CMake preset configuration support

Use generator expressions for include directories so paths don't
leak to consumers. Gate benchmarks and tests behind options that
default to OFF for subdirectory builds. Add EXPORT_NAME so the
imported target is Boost::capy across all consumption patterns.
Provide boost_install() for superproject builds and a standalone
install path with config/version files for find_package() support.
Remove CMakePresets.json and ASCII section dividers.
@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

📝 Walkthrough

Walkthrough

This PR modernizes the project's CMake configuration by introducing explicit build options (BOOST_CAPY_BUILD_TESTS and BOOST_CAPY_BUILD_BENCH), restructuring package installation logic with standard CMake patterns, removing CMakePresets.json, updating build instructions, and adding a CMake package config file for FetchContent integration.

Changes

Cohort / File(s) Summary
CMake Build Configuration
CMakeLists.txt, cmake/boost_capy-config.cmake.in
Introduced public build options BOOST_CAPY_BUILD_TESTS and BOOST_CAPY_BUILD_BENCH replacing implicit behavior. Restructured packaging/installation logic with GNUInstallDirs, install targets/headers/exports, and package config file generation. Updated target include directories with BUILD_INTERFACE/INSTALL_INTERFACE generator expressions and added EXPORT_NAME property.
Documentation & Metadata
README.md, .gitignore
Updated build instructions from CMake presets to explicit Ninja commands. Added "Consume via CMake" section with FetchContent integration example. Added .cache/ directory to .gitignore.
Build Presets
CMakePresets.json
Deleted configuration preset file containing standalone build preset with Ninja generator and cache variables.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Poem

🐰 Hopping through CMake with glee,
Build options now explicit, not hidden away,
FetchContent brings capy to thee,
No presets, just clear paths to play,
Package config makes integration weigh-hay! 🎉

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly summarizes the main changes: addition of support for FetchContent, add_subdirectory, and standalone install, which align with the primary modifications across CMakeLists.txt, README.md, and the new config file.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://182.capy.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-02-23 19:30:48 UTC

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
README.md (1)

23-37: Pin FetchContent to a release/commit for reproducible builds.

Using a moving branch can cause non-deterministic builds; consider a fixed tag or commit SHA.

Suggested doc tweak
 FetchContent_Declare(capy
     GIT_REPOSITORY https://github.com/cppalliance/capy.git
-    GIT_TAG develop
+    GIT_TAG vX.Y.Z # or a specific commit SHA
     GIT_SHALLOW TRUE)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 23 - 37, Update the CMake example in the README to
pin FetchContent to a fixed release tag or commit SHA instead of the moving
branch "develop": modify the FetchContent_Declare call (symbol:
FetchContent_Declare) to set GIT_TAG to a specific release (or commit SHA) and
keep GIT_REPOSITORY and GIT_SHALLOW as needed so consumers get reproducible
builds when linking Boost::capy via target_link_libraries.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@README.md`:
- Around line 23-37: Update the CMake example in the README to pin FetchContent
to a fixed release tag or commit SHA instead of the moving branch "develop":
modify the FetchContent_Declare call (symbol: FetchContent_Declare) to set
GIT_TAG to a specific release (or commit SHA) and keep GIT_REPOSITORY and
GIT_SHALLOW as needed so consumers get reproducible builds when linking
Boost::capy via target_link_libraries.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 505e20c and e741672.

📒 Files selected for processing (5)
  • .gitignore
  • CMakeLists.txt
  • CMakePresets.json
  • README.md
  • cmake/boost_capy-config.cmake.in
💤 Files with no reviewable changes (1)
  • CMakePresets.json

@cppalliance-bot
Copy link

GCOVR code coverage report https://182.capy.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://182.capy.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://182.capy.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-02-23 19:43:59 UTC

@sgerbino sgerbino merged commit f363cce into cppalliance:develop Feb 23, 2026
13 of 14 checks passed
@sgerbino sgerbino deleted the pr/cmake branch February 23, 2026 19:54
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