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

Andre Poenitz andre.poenitz at mathematik.tu-chemnitz.de
Mon Nov 9 19:22:36 CET 2009


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'



More information about the Qt-creator-old mailing list