Preset resolution#
clibra is preset-driven. Every subcommand needs a preset name to know
which build directory, generator, and LIBRA_* flags to use.
Resolution order#
When --preset is not given, clibra resolves a preset name
in this order:
--preseton the current invocation.vendor.libra.defaultConfigurePresetinCMakeUserPresets.json.A subcommand-specific default (see table below).
Fail with a clear, actionable error.
The persistent default is read only from CMakeUserPresets.json —
never from CMakePresets.json. The default is a per-developer,
per-workspace convenience setting rather than a shared project decision,
so it lives in the git-ignored user file. clibra does not read a
vendor.libra.defaultConfigurePreset key placed in
CMakePresets.json.
Subcommand |
Default preset |
Notes |
|---|---|---|
|
(none) |
Must be given explicitly or via the user-presets default. |
|
(none) |
Must be given explicitly or via the user-presets default. |
|
|
Falls back to the |
|
|
Falls back to the |
|
|
Falls back to the |
|
|
Falls back to the |
|
(none) |
Must be given explicitly or via the user-presets default. |
|
(none) |
Must be given explicitly or via the user-presets default. |
|
(none) |
Does not require a configured build directory. |
Feature-flag requirements by subcommand#
Beyond resolving a preset name, each subcommand validates that the
resolved preset’s CMake cache has the required LIBRA_* flags enabled
and that the expected targets exist. Validation runs against the cache of
the already-configured build directory; a missing build directory
produces an early, actionable error rather than a silent misfire.
Subcommand |
Required |
Required CMake targets |
|---|---|---|
|
(none) |
(any valid CMake build target) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(none) |
|
|
(none) |
|
Setting a personal default#
Use clibra preset default to record a
per-developer default. It writes the vendor.libra namespace of
CMakeUserPresets.json for you:
clibra --preset debug preset default
clibra build # uses debug
clibra test # uses debug
The resulting CMakeUserPresets.json (git-ignored) looks like:
{
"version": 6,
"vendor": {
"libra": {
"defaultConfigurePreset": "debug"
}
}
}
The vendor namespace is used rather than a top-level field because it
is the correct CMake extension mechanism for tool-specific metadata that
CMake itself ignores.
No sidecar files#
clibra does not maintain any sidecar files or hidden directories
beyond CMakePresets.json and CMakeUserPresets.json. There is no
“active preset” concept stored on disk — the user-presets vendor field is
the only persistent default, and it is always a plain JSON file that
cmake itself can read.
Inheritance and binaryDir resolution#
When clibra needs the build directory path (e.g. to check whether
a configure step is needed), it reads it from the preset’s binaryDir
field, walking the inherits chain and expanding CMake preset macros
(${sourceDir}, ${presetName}, ${sourceDirName}). If
binaryDir is absent, ./build is used as the default.
Recommended preset hierarchy#
See CMakePresets.json for the full recommended
CMakePresets.json starting point, including the base hidden preset
pattern that ensures every child preset is fully self-describing, and
Feature flags for the rationale behind each named preset.