PDA

View Full Version : .pro file syntax



lxman
30th January 2011, 21:17
I have managed to build a Qt app on my Fedora 14 64 bit box, install Qt in wine, and successfully build my app under the wine environment so that I can build the linux as well as the windows version on my 64 bit linux machine. I feel that I have accomplished quite a bit. :D

I have one remaining issue which I would appreciate some help resolving.

I am statically linking to an outside library. When compiling on the windows side, I want to link to the release version when I am making a release version of my app, and I want to link to the debug version of the external library when I am making the debug version of my app.

In my .pro file I have the following:

unix {
unix stuff
}
win32 {
win stuff
}
In order to select the debug or release version, I have tried the following:

win32 {
CONFIG(release debug|release) {LIBS += path\to\release\library.a}
CONFIG(debug debug|release) {LIBS += path\to\debug\libraryd.a}
}
As well as:

win32 {
release {LIBS += path\to\release\library.a}
debug {LIBS += path\to\debug\libraryd.a}
}
Neither one of these throws any errors when compiling, but neither one of them produces the desired result, as the linker uses the same library either way.

What is the correct syntax to accomplish what I am trying to do?

stampede
31st January 2011, 00:08
Try using the "build_pass", something like this:

build_pass:CONFIG(debug, debug|release) {
LIBS += debug libs
} else {
LIBS += release libs
}

lxman
31st January 2011, 01:21
Works like a champ! Thank you very much. :cool:

ktk
4th February 2011, 23:01
While the 'buildpass' hint is correct, I believe the real problem was the missing comma in CONFIG(release,debug|release)

elcuco
11th February 2011, 23:21
Not directly related to what you asked... but you can cros compile directly from Fedora into win32. See this post (about Fedora 11, but will still apply to your case):
http://lukast.mediablog.sk/log/?p=155