I too agree. This isn't the first thread asking for this.
The closest thing available that I'm aware of are the standard DATE and TIME macros, and obviously these are not traceable like a revision number. I could rebuild a project weeks later and create an "old" version - other than the date stamp, and it is difficult to prove.
For lack of a better solution, I often do this:
const char * PROG_INFO = "My Apps Name: " __DATE__ ", " __TIME__;
Then I emit it to the USB serial port and/or to a connected display.
But like you, I wish the build environment slipped in something like:
-D=REV_MAJOR=58
-D=REV_SERIAL=26658a56112a
-D=REV_STATUS=SYNCED (or REV_STATUS=CHANGED)
With this, it would be reasonably traceable to a specific version, or at least to identify the version it was derived from. With this, not just the program, but each library can be identified.
Hi all,
I'd like to have an automatic way of inserting version numbers into the compiled code.
Perhaps the commit level (+1 for every commit) and compile level (+1 for every compile of that commit level).
Feel free to ignore this if it's already possible through clever use of C and/or whatnot, I'm new to this C thing.
/Hugo