[Qt-creator] Control where the compiled object files go?

Stephen Chu stephen at ju-ju.com
Mon Nov 9 20:18:10 CET 2009


In article <20091109182236.GC3127 at tu-chemnitz.de>,
 Andre Poenitz <andre.poenitz at mathematik.tu-chemnitz.de> wrote:

> On Mon, Nov 09, 2009 at 10:42:23AM -0500, Stephen Chu wrote:
> > Thanks. That's what I am looking for. So I added these lines to my pro 
> > file:
> > 
> > CONFIG(release, debug|release) {
> >    macx:CONFIG += x86 ppc
> >    BUILD_NAME = release
> > } else {
> >    BUILD_NAME = debug
> > }
> > macx:PLATFORM_NAME = mac
> > win32:PLATFORM_NAME = win
> > 
> > DESTDIR = ./$$BUILD_NAME/$$PLATFORM_NAME
> > OBJECTS_DIR = $$DESTDIR
> > 
> > And it works.
> > 
> > The odd part is if I use CONFIG(debug) it's always invoked in both debug 
> > and release builds. Same with CONFIG(release). I have to use 
> > CONFIG(release, debug|release) and else to make it work.
> 
> Citing 
> http://doc.trolltech.com/4.5/qmake-function-reference.html#config-config
> 
>   [The CONFIG() function]
> 	This function can be used to test for variables placed into the CONFIG
> 	variable. This is the same as regular old style (tmake) scopes, but has
> 	the added advantage a second parameter can be passed to test for the
> 	active config. As the order of values is important in CONFIG variables
> 	(i.e. the last one set will be considered the active config for mutually
> 	exclusive values) a second parameter can be used to specify a set of
> 	values to consider. For example:
> 
> 	 CONFIG = debug
> 	 CONFIG += release
> 	 CONFIG(release, debug|release):message(Release build!) #will print
> 	 CONFIG(debug, debug|release):message(Debug build!) #no print
> 
> 	Because release is considered the active setting (for feature parsing)
> 	it will be the CONFIG used to generate the build file. In the common
> 	case a second parameter is not needed, but for specific mutual exclusive
> 	tests it is invaluable.
> 
> It's admittedly a weird syntax, but really nothing that needs to be
> discussed twice a day :-}
> 
> Andre'

Thanks for the pointer. I read the doc several times and still don't 
understand what it means or why it needs to be that way.

If debug and release are mutually exclusive, why do we need to define 
the set of values? Isn't there only one value between the 2 left in 
CONFIG? If debug and release are both in CONFIG, what does setting the 
value set help?

I know what to do to get it right now (always add the second parameter 
when testing for debug/release) but the doc really is absolutely of no 
help. :)

-- 
Stephen Chu



More information about the Qt-creator-old mailing list