What .prf files are automatically loaded by qmake?

You may wonder why the qmake CONFIG variable has values that you never set. Sometimes, you even need to remove some values from CONFIG in your .pro file using:

CONFIG -= qt

What is the default value of CONFIG? In my system, the initial value of CONFIG is

file_copies qmake_use qt warn_on release link_prl dummy_platform dummy_compiler copy_dir_files

Where do those values come? Well, qmake will load extra .prf files besides processing your project file. Specifically, qmake will call loadSpec() to load qmake super cache(_QMAKE_SUPER_CACHE_, find this file .qmake.super in current working directory, its parent directory, its grand-parent directory till root directory), c:\Qt5.12.1\5.12.1\Src\qtbase\mkspecs\features\spec_pre.prf, c:\Qt5.12.1\5.12.1\Src\qtbase\mkspecs\dummy\qmake.conf(or other spec configure file such as c:\Qt5.12.1\5.12.1\Src\qtbase\mkspecs\win32-g++\qmake.conf, which loads g++-win32.conf, device_config.prf,c:\build\qtbase\mkspecs\qdevice.pri,gcc-base.conf,sanitize.conf,g++-base.conf,angle.conf,windows-vulkan.conf,qt_config.prf,c:\build\qtbase\mkspecs\qconfig.pri,all *.pri in c:\build\qtbase\mkspecs\modules\, all *.pri c:\build\qtbase\mkspecs\modules-inst\, qt_functions.prf), c:\Qt5.12.1\5.12.1\Src\qtbase\mkspecs\features\spec_post.prf, .qmake.conf(find this file in .pro directory, its parent directory, its grand-parent directory, till root directory), qmake cache(_QMAKE_CACHE_) file .qmake.cache(find it in working directory, its parent directory, its grand-parent directory till root directory), .qmake.stash (find it in working directory, its parent directory, its grand-parent directory till root directory). .qmake.conf, .qmake.cache, .qmake.stash are usually only present when you qmake a .pro in qt source code. Qmaking your own projects typically does not load these files. .qmake.conf is in qt source directory, which loads qt_build_config which includes C:/build/mkspecs/qmodule.pri which belongs to the qtbase configure results which stores the arguments you provided to the configure command such as EXTRA_INCLUDEPATH(the -I xxx option), EXTRA_LIBDIR(the -L yyy option). The .qmake.cache is usually in build shadow directory such as c:\build\qtbase\.qmake.cache. The .qmake.stash is in both the source directory and the shadow build directory which contains some QMAKE variables such as QMAKE_CXX.INCDIRS, but qmake only loads the shadow build version. Then qmake continues to load c:\Qt5.12.1\5.12.1\Src\qtbase\mkspecs\features\default_pre.prf, before loading your .pro file, and load c:\Qt5.12.1\5.12.1\Src\qtbase\mkspecs\features\default_post.prf after loading your .pro file. The handling logic is in the QMakeEvaluator::visitProFile function of c:\Qt5.12.1\5.12.1\Src\qtbase\qmake\library\qmakeevaluator.cpp. The values of CONFIG is prefilled by those project feature files.

You may already know qmake will load features specified by CONFIG. For example, if CONFIG=…qt…, qmake will load qt.prf. But the load of such feature files is not done as soon as you add the config to CONFIG, but delayed towards the end of QMakeEvaluator::visitProFile after the load of default_post.prf, by the evaluateConfigFeatures function. Of course, qmake will only load the configure features if the xxx.prf file exists, and ignore those that do not exist.

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:
Posted in

Leave a Reply