Qt Extended Home · Build System Home · Reference · User Guide · Internals codeless banner

CONFIG

CONFIG is a variable just like other qmake variables but there are special behaviours for CONFIG.

Testing for values in a variable is done like this.

    VAR+=foo
    contains(VAR,foo):message(foo)
    !contains(VAR,bar):message(!bar)

While this also works with CONFIG, the following shorthand is generally used.

    CONFIG+=foo
    foo:message(foo)
    !bar:message(!bar)

There is a CONFIG() function to help with mutually-exclusive values too. Here's how it works.

    CONFIG+=debug
    CONFIG+=release
    debug:message(debug) # WRONG
    CONFIG(debug,debug|release):message(debug) # CORRECT

Finally, after your qbuild.pro file is read the values in CONFIG are used to locate .prf files.

    CONFIG+=foo # will cause foo.prf to be loaded, if it exists

Since CONFIG is used for so many things there are some conventions to reduce the change of a naming conflict.

See also Variables and CONFIG Values.


Copyright © 2009 Trolltech
Qt Extended - Build System Documentation