Skip to content

fix(cmake): use CMAKE_EXPORT_COMPILE_COMMANDS so compile_commands.json is generated - #354

Open
marcft wants to merge 1 commit into
1a1a11a:developfrom
marcft:fix/cmake-export-compile-commands
Open

marcft wants to merge 1 commit into
1a1a11a:developfrom
marcft:fix/cmake-export-compile-commands

Conversation

@marcft

@marcft marcft commented Oct 18, 2026 •

Copy link
Copy Markdown

What does this PR do?

While setting up the project following CONTRIBUTING.md, I noticed that the documented build steps (here and in the README) don't generate compile_commands.json, even though CMakeLists.txt is meant to ("export compile commands, useful for IDEs"). Line 17 sets EXPORT_COMPILE_COMMANDS, which is missing the CMAKE_ prefix, so CMake just ignores it. The pre-commit hook and the CI clang-tidy job don't notice, because they pass -DCMAKE_EXPORT_COMPILE_COMMANDS=ON themselves.

This adds the prefix, so clangd and editors like VS Code pick up the right include paths after a normal build.

Type of change

  • Bug fix
  • New eviction / admission / prefetch algorithm
  • New trace reader or trace format
  • Performance improvement
  • Documentation
  • Build / CI
  • Other:

How was it tested?

On macOS, running cmake -G Ninja -B _build without the -D flag: on develop there's no _build/compile_commands.json, and with this change it gets generated.

I also did a clean release build of the branch and ran the CLI tests (test/test_cli.sh), which all pass.

  • ctest --test-dir _build --output-on-failure passes
  • Build is warning-free (CI uses -Wall -Wextra -Werror)

Checklist

  • Formatted with clang-format (or the pre-commit hook from scripts/setup_hooks.sh) (n/a)
  • Added or updated tests (n/a)
  • Added or updated documentation (n/a)
  • New algorithms are registered in the CLI and listed in the README (n/a)

…n is generated

CMakeLists.txt set EXPORT_COMPILE_COMMANDS (missing the CMAKE_ prefix),
which CMake ignores, so compile_commands.json was only produced when
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON was passed on the command line.
@marcft
marcft requested a review from haochengxia as a code owner October 18, 2026 20:41
Copilot AI balanced review requested due to automatic review settings October 18, 2026 20:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
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