3

I'm new to Qt Creator and I have several questions regarding multiple build configurations. A side note: I have the QtCreator 1.3.1 installed on my Linux machine.

I need to have two configurations in my Qt Creator project. The thing is that these aren't simply debug and release but are based on the target architecture - x86 or x64. I came across Building multiple targets in Qt / Qmake and from that I went trying something like:

Conf_x86 {
 TARGET = MyApp_x86
}

Conf_x64 {
 TARGET = MyApp_x64
}

This way however I don't seems to be able to use the Qt Creator IDE to build each of these separately (Build All, Rebuild All, etc. options from the IDE menu). Is there a way to achieve this - may be even show Conf_x86 and Conf_x64 as new build configurations in Qt Creator?

One other thing the Qt I have is 64 bit so by default the target built using Qt Creator IDE will also be 64 bit. I noticed that the effective qmake call in the build step includes the following option -spec linux-g++-64. I also noticed that should I add -spec linux-g++-32 in 'Additional arguments' it would override -spec linux-g++-64 and the resulting target will be 32 bit.
How can I achieve this by simply editing the contents of the .pro file? I saw that all these changes are initially saved in the .pro.user file but this doesn't suit me at all. I need to be able to make these configurations from the .pro file if possible.

Cœur
  • 37,241
  • 25
  • 195
  • 267
user360607
  • 363
  • 1
  • 5
  • 14

1 Answers1

2

You can use Project Settings panel to add your own build configurations. You can set what make spec for each config there. Once you create a new build config, you can use it in pro file by using the CONFIG control:

CONFIG(Conf_x86) {
# do something
}
CONFIG(Conf_x64) {
# do some other thing
}
Stephen Chu
  • 12,724
  • 1
  • 35
  • 46
  • 10x for the answer. Still, I need a way to define the configurations in the .pro file if possible. As far as I know any custom configurations are stored in the the .pro.user file which I don't want to rely on. About '-spec ...' is there a way to add it as part of .pro file definitions, in that case what is the key word/section (like CONFIG, LIBS, INCLUDE, etc.)? – user360607 Jun 21 '10 at 06:19