Skip to content

Conversation

@nyibbang
Copy link
Contributor

@nyibbang nyibbang commented Jan 19, 2026

Summary

This change replaces CMAKE_SOURCE_DIR by PROJECT_SOURCE_DIR in the code that generates the .clangd file in CMakeLists.txt.

Motivation

CMAKE_SOURCE_DIR is the source directory that was given on the invocation of CMake. When including BT.CPP in other projects, through git submodules, CMake FetchContent or CPM, the project is not often not at the root of the sources. In that case, the .clangd file is most likely incorrect and the include paths relative to CMAKE_SOURCE_DIR are too.

Furthermore, it may overwrite the .clangd file in the root project that includes BT.CPP which is unwanted.

Impacts

There should be not impact on API, ABI or tests.

This allows the project to be used as a submodule or subdirectory of
another CMake project without rewriting their `.clangd` file. This
includes using BT.CPP through CMake FetchContent or CPM.
@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

The CMakeLists.txt file is updated to use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR when generating the .clangd configuration file. This change affects both the output path destination and all included search path references within the generated configuration.

Changes

Cohort / File(s) Summary
CMake Build Configuration
CMakeLists.txt
Updated .clangd file generation to use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR for output path and all search path references (7 replacements). No control flow modifications.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit hops through paths so clear,
From CMAKE's root to PROJECT dear,
The .clangd config now aligns so right,
With PROJECT_SOURCE_DIR in sight!
✨ Precision in every line!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request provides a comprehensive description covering the summary, motivation, and expected impacts, aligning well with the repository's template requirements.
Title check ✅ Passed The title directly and concisely summarizes the main change: generating the .clangd file in PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR, which is the primary modification across the CMakeLists.txt file.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@nyibbang nyibbang changed the title Generate .clangd in PROJECT_SOURCE_DIR Generate .clangd in PROJECT_SOURCE_DIR Jan 19, 2026
@facontidavide facontidavide merged commit b3dbe30 into BehaviorTree:master Jan 19, 2026
12 checks passed
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