Skip to content

build(cmake): always export compile_commands.json (CoolProp-2uw.7)#2789

Merged
ibell merged 1 commit into
masterfrom
ib/compile-commands
Apr 26, 2026
Merged

build(cmake): always export compile_commands.json (CoolProp-2uw.7)#2789
ibell merged 1 commit into
masterfrom
ib/compile-commands

Conversation

@ibell
Copy link
Copy Markdown
Contributor

@ibell ibell commented Apr 26, 2026

Summary

Tier 2.3 of the C++ code-quality epic (CoolProp-2uw). Sets CMAKE_EXPORT_COMPILE_COMMANDS ON unconditionally in CMakeLists.txt so any cmake configure produces compile_commands.json automatically. Unblocks:

  • CoolProp-2uw.5 (clang-tidy-diff CI workflow)
  • CoolProp-2uw.6 (clang-tidy pre-commit hook)
  • CoolProp-2uw.11 (IWYU report job)
  • CoolProp-2uw.13 (safe clang-tidy --fix passes)

Plus editor LSP integrations (clangd, ccls).

Verification

Tested locally with the Ninja generator on macOS arm64:

  • Fresh cmake -G Ninja -B build_tidy -S . (no explicit export flag) produces build_tidy/compile_commands.json
  • 97 entries covering src/
  • clang-tidy -p build_tidy src/CPstrings.cpp runs and surfaces real .clang-tidy warnings (e.g., readability-isolate-declaration, misc-include-cleaner)

New: dev/ci/README.md

Documents the contributor build invocation. Includes a macOS sysroot caveat — the Homebrew llvm@18/llvm packages ship clang-tidy but don't see Apple's Xcode SDK by default. Workaround:
```bash
SDK=$(xcrun --show-sdk-path)
clang-tidy -p build --extra-arg=--sysroot=$SDK src/...
```
CI runs on Ubuntu where this issue doesn't apply.

Test plan

  • CI builds remain green (no semantic build change — just adds a JSON file output)
  • After merge, cmake -B build -S . produces build/compile_commands.json with no extra flags
  • clang-tidy -p build src/<file>.cpp consumes it without unresolved-include errors on Linux

Related

🤖 Generated with Claude Code

Set CMAKE_EXPORT_COMPILE_COMMANDS ON unconditionally so any cmake configure
produces compile_commands.json. Required for clang-tidy (Tier 2.1, 2.2),
include-what-you-use (Tier 3.4), and editor LSP integrations.

Verified locally with Ninja generator: 97 entries covering src/ produced
without any explicit -DCMAKE_EXPORT_COMPILE_COMMANDS=ON flag.

Adds dev/ci/README.md documenting the contributor invocation, including
the Homebrew clang-tidy / Apple-SDK sysroot caveat for macOS contributors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ibell ibell force-pushed the ib/compile-commands branch from 34d37f3 to 65c8bd9 Compare April 26, 2026 13:32
@ibell ibell merged commit d9af384 into master Apr 26, 2026
1 check passed
ibell added a commit that referenced this pull request Apr 26, 2026
…2797)

Tier 3.4 of the C++ code-quality epic. include-what-you-use is already
wired into CMakeLists.txt via the COOLPROP_IWYU opt-in (and depends on
compile_commands.json from CoolProp-2uw.7, which landed in #2789). This
workflow runs the IWYU build on every PR and uploads the full report
as a downloadable artifact.

Warning-only: continue-on-error on the build step, if: always() on the
upload, never fails a PR. IWYU output is high-noise and its suggestions
need per-file judgment — the artifact gives contributors and AI agents
the data without forcing a per-PR triage.

Trigger model: PR + master push + weekly fallback + workflow_dispatch
(matches the cadence the rest of the warning-only workflows use).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ibell ibell deleted the ib/compile-commands branch April 26, 2026 14:43
@ibell ibell added this to the v8.0.0 milestone May 27, 2026
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.

1 participant