[Interest] How to define something for all sub-projects?

Bo Thorsen bo at vikingsoft.eu
Tue Sep 2 07:20:36 CEST 2014


Den 01-09-2014 17:42, Igor Mironchik skrev:
> Hi,
> how to define macro in “parent” .pro file that it will take effect for
> all sub-projects?
> DEFINES += SOME_MACRO
> in “parent” .pro file does not take effect for sub-projects...

You should put all things that are shared in the entire tree in a file 
called .qmake.conf at the top level.

My file looks like this:

top_srcdir=$$PWD
top_builddir=$$shadowed($$PWD)
librarydir=$${top_builddir}/libs

win32:!win32-g++ {
     EXE_EXTENSION=.exe
     LIB_PREFIX=
     LIB_POSTFIX=lib
     SHAREDLIB_POSTFIX=dll
} else {
     EXE_EXTENSION=
     LIB_PREFIX=lib
     LIB_POSTFIX=a
     SHAREDLIB_POSTFIX=so
}

This means I always have $$top_srcdir and $$top_builddir available, for 
example. All the lib/exe vars are used in calling code generators, 
setting up link dependencies etc.

Bo.

-- 
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu



More information about the Interest mailing list