Ray's Knowledge Base
Unlock

After editing CMakePresets.json, rerun cmake --preset <name> before building, because a plain rebuild keeps the old cache values

PitfallVerified 16 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

A new option or compile definition was set in a configure preset (for example DFTRACER_UTILS_TRACKED_BYTES in the bench preset). The target was rebuilt, but it did not see the value. A bench that stops with #error when the define is missing would fail on the stale build.

Cause#

cmake --build --preset <name> only builds. It does not re-run configure, so changed preset values are not applied to the existing build cache.

Fix#

Run cmake --preset <name> (for example cmake --preset bench) after changing CMakePresets.json or a preset-controlled option. Then run cmake --build --preset <name>.

Evidence#

In the TSK-zjc61r work, the agent reported: "The bench build only saw it after I ran cmake --preset bench, because a plain rebuild does not re-apply preset values."