Inital support for CMakeUserPresets.json and including other presets#85
Merged
MarkSchofield merged 1 commit intodevelopfrom Dec 20, 2025
Merged
Inital support for CMakeUserPresets.json and including other presets#85MarkSchofield merged 1 commit intodevelopfrom
MarkSchofield merged 1 commit intodevelopfrom
Conversation
3df0457 to
84180c4
Compare
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.
Fixes #1 and #49.
This PR adds support for
CMakeUserPresets.jsonand including other presets. The two are somewhat intertwined -CMakeUserPresets.jsonimplicitly includesCMakePresets.json- so I'm sending the PR for both. #81 laid the groundwork for this change - all paths that load presets go through a commonGetCMakePresetspath, and that can be responsible for resolving and merging the includes. Whilst merging is slightly more up-front work than I'd like - compared to, say, maintaining a list of loaded presets - caching the merged version sounds interesting... But I'll ponder the two approaches...The changes:
FindCMakePresets,FindCMakePresets,GetPathOfFileAbovechanges are necessary to supportCMakeUserPresets.json- the crux of which isGetPathOfFileAboveaccommodating multiple files and checking them in order - a CMakeUserPresets.json should be preferred over CMakePresets.jsonGetCMakePresetsis the support for 'includes' - it performs a breadth-first traversal of the presets .json, and accumulates the presets on the first instance found.By making sure that
CMakeUserPresets.jsonis preferred overCMakePresets.json, and that included presets are added to the end of existing presets, then theCMakeUserPresets.jsonpresets will be discovered first when presets aren't passed to, say,Build-CMakeBuildorConfigure-CMakebuild, and are included first in the tab-completion order.I haven't really thought too much about testing right now... Mocking out the file system seems like a good amount of work, and building reference presets sounds like a good amount of work. But getting this checked-in gets this into the Beta builds, and I'll try things out there.