Qmake
-
I am trying to understand what happens when executing qmake.
In a console application, I edited the .pro file and added the line "message(test)" at the bottom of the file. Then executed qmake on that project and the output was;
@
Project MESSAGE: test
Project MESSAGE: test
Project MESSAGE: test
@Why does qmake process the project file (.pro file) three times?
To investigate more we modifed the previous change to "message(CONFIG=$${CONFIG})" which produced this output;
@
Project MESSAGE: CONFIG=lex yacc warn_on debug uic resources rtti_off exceptions_off stl_off incremental_off thread_off windows qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe debug shared stl exceptions rtti mmx 3dnow sse sse2 qt consoleProject MESSAGE: CONFIG=lex yacc warn_on debug uic resources rtti_off exceptions_off stl_off incremental_off thread_off windows debug DebugBuild Debug
build_pass qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe debug shared stl exceptions rtti mmx 3dnow sse sse2 debug DebugBuild Debug build_pass qt consoleProject MESSAGE: CONFIG=lex yacc warn_on debug uic resources rtti_off exceptions_off stl_off incremental_off thread_off windows release ReleaseBuild Release build_pass qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe debug shared stl exceptions rtti mmx 3dnow sse sse2 release ReleaseBuild Release build_pass qt console
@
It appears that config variable is different for each time qmake processes the project file. The first 12 strings are identical for all three times and appear to be set by;
C:\Qt_r\4.7.1-vs2005\mkspecs\features\default_pre.prf
C:\Qt_r\4.7.1-vs2005\mkspecs\features\win32\default_pre.prfThe last two string "qt console" are also identical for all three and is set by the project file.
What is the purpose for each iteration \ processing of the project file? Why is the config variable different each time? What files are involved in setting the config variable?
I thought that keyword debug and release used within CONFIG referred to whether a debug version or release version of the project was being built. Why is then both keywords used atleast once in all three iterations? Does this mean we that project is setup to always built both debug and release?
Appreciate some feedback.
-
It appears that the file
C:\Qt_r\4.7.1-vs2005\mkspecs\win32-msvc2005\qmake.conf
is also involved when executing qmake for each iteration.Is the config variable case-sensitive? I noticed that both debug and Debug was used.
-
You know that, qmake is used to parse your .pro file and generate makefile files.
Normal, it will generate 3 makefiles:
@
Makefile
Makefile.Debug
Makefile.Release
@So, it run three times.
BTY, normally, variables in CONFIG will stand for feature files, such as qt.prf/console.prf/...
-
Thank you for the reply.
My understanding is building a debug version of the project will cause nmake to use Makefile.Debug and building release version will cause nmake to use Makefile.Release file. When is Makefile used?
I came across this text after posting;
bq. When qmake [doc.qt.nokia.com] processes a pro file it could process it up to three times depending on what the configuration is set to. Usually it will do it three times. Once for debug, once for release and one final one for debug_and_release. "[Source]":http://qt-project.org/faq/answer/what_does_the_syntax_configdebugdebugrelease_mean_what_does_the_1st_argumen
What configuration governs how qmake processes a project file?
-
You are always using Makefile, which contains a debug and release target and invokes Makefile.Debug and Makefile.Release respectively.
Depending on the selected mkspec (either using the -spec parameter or QMAKESPEC environment variable) the configuration (from $QTDIR/mkspecs/<mkspec>/qmake.conf) is read, and the QMAKE_ variables are set.