Repository navigation
Open
Description
Proposal
Add a tracked CMakePresets.json to ITK with common build configurations, reducing the barrier for developers and CI to use consistent, well-tested settings. Currently every developer invents their own cmake flags; a shared presets file would codify the known-good configurations.
Raised by @blowekamp in #6040 — he maintains a local CMakeUserPresets.json with presets like "development", "wrapping", "system-libraries", and "doxygen", and asked whether this should be adopted more widely.
Background
- PR ENH: Allow users to have a CMakeUserPresets.json file #2870 (merged 2021) added
CMakeUserPresets.jsonto.gitignore, enabling user-local presets - No tracked
CMakePresets.jsonexists yet — ITK has no shared preset definitions - The pixi workflow (
pixi run configure-ci) serves a similar role for CI but doesn't help developers using cmake directly - CMake presets are supported by VS Code, CLion, Visual Studio, and command-line cmake since CMake 3.19
Suggested presets
| Preset name | Purpose | Key flags |
|---|---|---|
dev |
Fast iteration, tests enabled | Release, BUILD_TESTING=ON, BUILD_SHARED_LIBS=ON, Ninja |
dev-debug |
Debug builds with assertions | Debug, BUILD_TESTING=ON, BUILD_SHARED_LIBS=ON |
wrapping |
Python wrapping | Release, ITK_WRAP_PYTHON=ON, BUILD_SHARED_LIBS=OFF |
minimal |
Fastest possible build | MinSizeRel, BUILD_TESTING=OFF, BUILD_EXAMPLES=OFF |
asan |
AddressSanitizer | RelWithDebInfo, -fsanitize=address |
These would live in CMakePresets.json (tracked in git). Developers can extend/override via CMakeUserPresets.json (gitignored, per PR #2870).
Usage
# Configure with a preset
cmake --preset dev
# Build
cmake --build --preset dev
# Test
ctest --preset devQuestions to resolve
- Should presets specify the compiler, or leave that to the user/environment?
- Should CI pipelines migrate from ad-hoc cmake flags to presets?
- Should the CLAUDE.md / AI documentation reference presets as the recommended build method?
- Relationship to pixi: should pixi tasks call
cmake --presetinternally?
References
- ENH: Allow users to have a CMakeUserPresets.json file #2870 — Added
CMakeUserPresets.jsonto.gitignore - DOC: Capture recent CI lessons in Documentation/AI/ skill files #6040 (comment) — @blowekamp's original suggestion
- CMake Presets documentation
Metadata
Metadata
Assignees
Labels
No labels
Activity