Search code examples
c++qtqmake

Read version constant by qmake in C++


I have seen where people will define variables like VERSION using a config.h header with autotools that are constants in C or C++, so that their version numbers are accurate. Is there a way to do this in qmake?

I added a line like

VERSION = 6.3.a

to my project.pro file.


Solution

  • @AlexHenrie's answer is correct but qmake prefers this settings in the DEFINES variable, like this:

    DEFINES += VERSION=$$VERSION
    

    For more information, see http://doc.qt.digia.com/4.6/qmake-variable-reference.html#defines