Version numbers are needed all over a project; in installers, code, toolchains etc. I despise duplication. I want my version numbers to be stored in one central authoritative location.
I am working with C/C++ and using Qt on various platforms. In Qt, qmake projects specify version numbers like:
VERSION = 1.2.3
In code I use something like in a header like Version.h:
#define VERSION_MAJ 1
#define VERSION_MIN 2
#define VERSION_REV 3
#define VERSION_STRING \"VERSION_MAJ\" "." \"VERSION_MIN\" "." \"VERSION_REV\"
My installer toolchain has support for C preprocessing so I can use the same version specified in Version.h. However, I don't know how to get qmake to use the same version number. I thought I could preprocess the pro file, but that won't work as # characters mean a comment in pro files and the C preprocessor will fall over.
Anyone know of a good way to keep my version number centralised?