PDA

View Full Version : need script to change qmake .pro file



rajeshs
7th July 2007, 07:12
Hello friends,

I am using Qt 4.2 and Mingw compiler, I am using qmake -project option to build my application , in my program i am using network stuff,

For that i need to add the following line in my .pro file at every time i build my application using project option,

QT+=network

Is there any way to write script to change .pro file ,so that i can able to add the above line into .pro file,

Thanks
Rajesh.S

jacek
7th July 2007, 09:40
Don't generate your .pro file with "qmake -project" every time. Simply edit it.

rajeshs
7th July 2007, 14:04
Instead of manual editing i need some common mechanism to edit the .pro file,

Thanks
Rajesh.S

jpn
7th July 2007, 14:46
Instead of manual editing i need some common mechanism to edit the .pro file
Perhaps it would be easier for you to use an IDE which would manage the project file for you. Try out ones mentioned in this thread (http://www.qtcentre.org/forum/f-newbie-4/t-ide-for-linux-7908.html).

pdolbey
7th July 2007, 18:40
Whilst I agree that it seems pretty odd to ever use qmake -project more then once, if you insist on rebuilding it every time you can easily concatenate the QT += network line. On Windows just put that single statement into a file called say qtnetwork.pri, then in your build process just include

copy myproj.pro+qtnetwork.pri myproj.pro

into your script. If you're on Linux then I'm sure you can adapt the principle.

Pete

jpn
7th July 2007, 18:53
Another way would be

qmake -project "QT += network"
but it's still odd. :)