View Full Version : How to add functions to a .pro file using QMake command line?

27th June 2009, 13:56
Dear all,

I create .pro files by using the following syntax:

qmake -project <project name>.pro [VARIABLES] .

Such as:

qmake -project MyProject.pro "UI_DIR = ui" "RC_FILE = MyProject.rc" "QT += network" .

However, unlike variables I can't see how it's possible to add functions to a .pro file via the command line. I would like the following line to appear in my .pro file:

include( $$(QTHOME)/my-extension/myext.prf )

But the following does not work:

qmake -project MyProject.pro "UI_DIR = ui" "RC_FILE = MyProject.rc" "QT += network"
"include( $$(QTHOME)/my-extension/myext.prf )" .

I'm sure this must be documented somewhere, but that somewhere is escaping me...

All help appreciated.

Kind Regards,

27th June 2009, 19:37
No, I don't think that's possible. But you can use echo or cat to redirect something into the pro file. You might introduce a wrapper over the qmake executable if you need to inject functions into project files on a regular basis.

28th June 2009, 13:39
Hi Wysota,

Thanks for responding.

I added the following to my build script (I'm working on windows) after the 'qmake -project' line:

echo include( %QTHOME%\my-extension\myext.prf)>>MyProj.pro

It works fine now.