PDA

View Full Version : qmake, subdirs & global vars



jpujolf
21st May 2009, 09:05
Hi folks,

I have a big project with this structure :



MainDir
+--src
+--Launcher
+--CoreLibrary
+--plugins
+--Plugin 1
+--...
+--Plugin N


Into MainDir I have a prf file with global configurations I don't want to repeat on every .pro file ( DESTDIR, debug/release options, don't care about it... )

All the structure is managed through *.pro / *.pri file. Until now I have defined a MAINDIR variable to use in all *.pri files, but I want to auto-define it. It's possible, I've done it in my MainDir.pro file.

It looks like this :



# Global variables, MAIN DIR
MAINDIR=$$IN_PWD
QMAKEFEATURES=$$IN_PWD

message($$MAINDIR)
message($$QMAKEFEATURES)

TEMPLATE = subdirs
SUBDIRS = src


When I run qmake, it shows the correct path, but ONLY for the first level of .pro, when passing to src subdir, the variable is undefined.

Anyone knows how to export variables in subdir templates ? I've been googling around an found nothing...