[Qt-interest] Using DEFINES for testing a condition

Sean Harmer sean.harmer at maps-technology.com
Tue Jul 13 15:09:48 CEST 2010


On Tuesday 13 July 2010 14:04:15 Chitrang Srivastava wrote:
> In my application, I want to pass DEFINES from command line and then use it
> in the pro file to test some condition.It not working.I am doing this way.
> $qmake DEFINES+=TEST
> 
> in pro file
> TEST{
> #do some stuff
> }else{
> #do something
> }
> 
> Any hints, how can I use DEFINES, passed from command line to qmake in pro
> file ?

Use the contains() function:

contains( DEFINES, TEST ) {
     # do stuff for test
 }

HTH,

Sean



More information about the Qt-interest-old mailing list