2026-05-13 12:23 PM
I am using the latest STM32CubeIDE on a Windows platform - developing code for a STM32G0B1.
I have a version.c file in my project that uses the __DATE__ and __TIME__ macros to create strings that I use in other modules.
To ensure this file gets compiled on every build, I have a custom Pre-Build step that "touches" that file. This all works fine.
However, if I use the IDE to load the code into my hardware, it always does a build beforehand. Because of this "touch", I get a new date string every time I run a debug session.
Is it possible to replace the "touch" step with some kind of dependency on "all source files"? In other words, can I make it so my version.c gets recompiled ONLY if some other source file has been updated?
I know that I can turn off the "Build (if required) before launching" option. But I'd rather keep that option as is, unless changing it is the only way to do what I want.
Thanks.