This is entire pro file:
message("This message should appeare only once!!!")
CONFIG += qt
SOURCES += src/main.cpp
I invoke qmake in the following way:
set QMAKESPEC=win32-msvc2008
set QTDIR=c:\Qt\4.8.4_vs2008\
call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
call "%QTDIR%\bin\qmake.exe" -tp vc Server.pro
And I get following output:
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
Project MESSAGE: This message should be appeared only once!!!
Project MESSAGE: This message should be appeared only once!!!
Project MESSAGE: This message should be appeared only once!!!
Why did the message print THREE times?
Because by default,
qmakewill create 3 makefiles:Makefile,Makefile.debug, andMakefile.release. This is because the default config is to build the project in debug and release modes. If you addCONFIG -= debug_and_releaseto your.profile, you should only see the message once. You can find more info here and here.