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 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, c:\Qt5.12.1\5.12.1\Src\qtbase\mkspecs\features\spec_post.prf, .qmake.stash in the same directory as current .pro file, and 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.

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