CMake Presets Generator
Build schema v6 CMakePresets.json with correct inherits, hidden bases and cache variables.
Preset forms
unnamedCMakePresets.json
7 lines · 88 bytesNo presets configured yet
Name a configure preset or load an example.
Examples
Hidden base
base hidden, debug inherits base"hidden": true, "inherits": ["base"]Hidden presets never appear in --list-presets but remain valid parents.
Release override
child sets CMAKE_BUILD_TYPE=Release"CMAKE_BUILD_TYPE": { "value": "Release" }Child values win over inherited values; conflicts are explained in the validation panel.
Toolchain file
vcpkg toolchain path"CMAKE_TOOLCHAIN_FILE": { "type": "FILEPATH" }Toolchain files belong in the configure preset's cacheVariables object.
About this tool
CMake Presets Generator turns a small set of forms into a complete CMakePresets.json at schema version 6. It covers configure presets with generators, binary directories, cache variables and toolchain files, plus build and test presets that reference them correctly.
Inheritance is modeled explicitly: presets can inherit an ordered chain of parents, hidden base presets can carry shared settings, and cache variables are merged with child-wins semantics. Conflicts are reported so you can see where a release child overrides a debug base rather than wondering why CMake picked a value.
Validation runs before copy or download. Duplicate names, inheritance cycles, unknown parents and dangling configurePreset references are hard errors; absolute binary directories are warnings because they break on other machines. The output is deterministic and paired with the four commands you will actually run: cmake --list-presets, cmake --preset, cmake --build --preset and ctest --preset.
What this tool does not do
- Does not author CMakeLists.txt or resolve target-level build logic.
- Workflow presets and package presets are not modeled.
- CMakeUserPresets.json is not edited; keep machine-local overrides in that file yourself.
- Import of existing files is out of scope in this version.
How to use this tool
Name a configure preset
Start with a name such as debug, choose a generator and set a macro-based binaryDir.
Add children
Enable the release child to see inherits and cache-variable overrides in the emitted JSON.
Add build and test presets
Choose whether to include a test preset; both reference an existing configure preset.
Download and verify
Save as CMakePresets.json, then run cmake --list-presets to confirm CMake reads it.
Use cases
First team preset file
Standardize a repository's configure and build commands without flag soup.
CI matrix
Generate explicit debug and release presets for pipeline jobs.
Teaching C++
Give students a scaffold with correct inheritance and macro-based build directories.
Emitted preset keys
| Preset type | Required |
|---|---|
| Configure | name, generator, binaryDir |
| Build | name, configurePreset |
| Test | name, configurePreset |
The file always starts with version: 6 and object order is stable across edits.
Common mistakes
Mistake:Inheriting across preset types.
Fix:Build presets inherit build presets; configure presets inherit configure presets.
Mistake:Hard-coding /home/me/build as binaryDir.
Fix:Use ${sourceDir} or ${sourceDirName} macros.
Mistake:Expecting a hidden base to show in cmake --list-presets.
Fix:Hidden presets are intentionally omitted; their children are listed.
Mistake:Putting toolchain paths outside cacheVariables.
Fix:Set CMAKE_TOOLCHAIN_FILE as a FILEPATH cache variable.
Mistake:Using schema version 2 with conditions.
Fix:This tool emits version 6, which supports condition objects.
Frequently asked questions
What is a hidden base preset for?
A hidden preset holds shared settings such as a generator and common cache variables. It never appears in cmake --list-presets, but children can inherit from it. This keeps your visible list short while avoiding duplicated configuration.
How does inherits merge cache variables?
CMake applies parents in order and then the child's own fields. When the same cache variable appears twice, the child wins. The generator shows the final resolved value and lists the variables that were overridden so the merge is not a mystery.
Which schema version should I use?
Use version 6 for modern CMake installations. Older versions drop fields such as conditions; this tool always emits version 6 and validates that conditions are not paired with an ancient version.
Where do build and test presets reference configure presets?
Through the configurePreset key on each build or test preset. It must name an existing configure preset. The validator catches typos before you download the file.
Can I keep machine-specific presets out of git?
Yes. Put personal overrides in CMakeUserPresets.json and add that file to .gitignore. Commit only the shared CMakePresets.json your team agrees on.
How do I verify the generated file?
Save it at the project root and run cmake --list-presets. If CMake parses the file, your configure, build and test presets appear in the list; the generated usage snippet has all four commands.
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.gitattributes Generator
Build .gitattributes rules for line endings, Git LFS, GitHub linguist marks and merge drivers — with a one-line explanation for every rule.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
A/B Test Sample Size Calculator
Compute required sample size per variant and test duration from baseline conversion rate, minimum detectable effect, alpha and power.
ABA Routing Number Validator
Validate 9-digit US ABA routing numbers with 3-7-1 Mod-10 breakdown.