Difference between qmake CONFIG and qtConfig

qmake variable CONFIG contains the conditions that are evaluated to true.

CONFIG += abcdefg

qtConfig is a qmake test function which returns true if the tested feature is an enabled feature of some module, or returns false if the tested feature is disabled by some module. For example, since  QT.gui.enabled_features = accessibility action dynamicgl angle …, so qtConfig(accessibility) returns true. Since QT.gui.disabled_features = opengles2 …., qtConfig(opengles2) returns false. If you provide an unknown feature as the parameter of qtConfig like qtConfig(abcdefg), it will complain “Could not find feature abcdefg” and qmake fails.

There are two versions of qtConfig, one is in qt_functions.prf, the other is in qt_build_config.prf. The former version is commonly used when you qmake some .pro file, while the latter is only used when you build qt from source code. When you build any qt module from source, the C:\Qt\Qt5.12.1\5.12.1\Src\qtbase\.qmake.conf will be loaded, which loads qt_build_config.prf. When you qmake c:\Qt\Qt5.12.1\5.12.1\Src\qtbase\qtbase.pro, qt_build_config.prf is also loaded. Since qt_build_config.prf is loader after qt_functions.prf, the second version of qtConfig will replace the first version. The difference between  qt_build_config.prf qtConfig and qt_functions.prf qtConfig is that the former includes the current configure result of the module in question such as c:\build\qtbase\src\gui\qtgui-config.pri, which updates the staled QT.gui.enabled_features and QT.gui.disabled_features loaded from mkspecs/modules and mkspecs/modules-inst generated from last qmaking of the module in question.

Both versions of qtConfig check QT.gui.enabled_features and QT.gui.disabled_features, so both qt_functions.prf and qt_build_config.prf are loaded after *.pri in mkspecs/modules and mkspecs/modules-inst  are loaded.


If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!
Posted in

Leave a Reply