Support includes when parsing CMake preset files - #624
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the project’s minimal CMake preset reader to support include directives in preset JSON files, enabling presets to be composed across multiple files (including recursive includes) and supporting limited macro expansion in include paths.
Changes:
- Add recursive traversal of preset
includegraphs when resolving presets. - Implement limited macro expansion for include paths (
${hostSystemName}and$penv{VAR}), with errors on unsupported macros. - Expand and refactor tests to cover include behavior, recursion, relative path resolution, and macro expansion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| aoc-main/src/aoc_main/_cmake_presets.py | Adds include-graph traversal, include macro expansion, and a cached file loader to support presets spread across multiple files. |
| aoc-main/tests/test_cmake_presets.py | Refactors preset-file writing helper and adds test coverage for includes, recursion, relative include resolution, and macro behaviors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nikobockerman
force-pushed
the
support-includes-in-cmake-preset-files
branch
from
July 25, 2026 17:08
d40c445 to
ff3aa9d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
aoc-main/src/aoc_main/_cmake_presets.py:176
_walk()yields the implicit project file(s) before the current file’s explicitincludelist. Because_get_preset()returns the first match, this makes presets from user-included files lower-precedence than project presets, which contradicts the stated “user presets take precedence over project presets” behavior when a user include defines the same preset name as the project file. Traverse explicit includes before implicit convention-includes so user-side includes still override project presets.
for include_path in implicit:
yield from self._walk(include_path, visited=visited)
for include_path in preset_file.includes:
if self._load_file(include_path) is None:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.