Version Numbers in a project with Qt
If you want to be able to store your version numbers in a c header file, you can do so and then import them into the Qt project variables in the project file. Something like the below should work:
Version.h:
#define MY_MAJOR_VERSION 3
#define MY_MINOR_VERSION 1
.pro
HEADERS += Version.h
VERSION_MAJOR = MY_MAJOR_VERSION
VERSION_MINOR = MY_MINOR_VERSION
The advantage of doing it this way round is that you can then use your authoritative header file if you need to compile other parts of the project away from Qt.
I use something like this in my build system
#.pro file
#Application version
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_BUILD = 0
DEFINES += "VERSION_MAJOR=$$VERSION_MAJOR"\
"VERSION_MINOR=$$VERSION_MINOR"\
"VERSION_BUILD=$$VERSION_BUILD"
#Target version
VERSION = $${VERSION_MAJOR}.$${VERSION_MINOR}.$${VERSION_BUILD}
And after that you can use VERSION_MAJOR and others as normal macro in your application.