IncrementBuildNumber

The utility reads a first line of supplied C/C++ header file. The line must have the following format:

#define <identifier> <decimal number>

The number is incremented, and the resulting definition is written back to the file (on the place, no file deletion/creation occurs).

All file contents is overwritten, so the file must not contain other useful information.

Default mode is useful for the "pre-incrementing" strategy, where build number incrementing precedes the build process. After the build process is completed, target file contains the same number as the build number definition file.

If the -n option is specified, a second macro definition is appended, with the "Next" suffix added to the identifier, and with the number incremented again. It may be useful for the "post-incrementing" strategy, where the build process starts first and uses the next build number value to place into the target file. When all steps are completed, target file contains the same build number as the current (defined in the first line) build number.

With the -t option, the utility preserves file modification (last write) time. It is useful to prevent the project from being rebuild automatically due to the updated time.

With no -t option, file modification time is set two seconds earlier than the current time, to prevent build number definition header file from being newer that the target file.