Discussion:
qmake debug release conditional builds
paulo
2009-11-08 23:29:18 UTC
Permalink
Hi all,

there's been a few threads about conditional release debug build problems.
I myself wrote one a while ago, but with no success.

Anyone can try something like this:


debug {

release {

error("release set with debug!")

}

TARGET = app.bin

} else {

TARGET = app.dbg

}


This is a bit annoying. Apparently due to a bit of mess in the loaded
config files, or some problem in qtcreator, both debug and release flags
are set at the same time...

Can anyone confirm this?
I'm not going to look into this right now, since debug is enough for me
now, but I'll look into it tomorrow.
If anyone finds a solution before me, please say so.

Thanks
Paulo
Andre Poenitz
2009-11-08 14:53:50 UTC
Permalink
Post by paulo
Hi all,
there's been a few threads about conditional release debug build problems.
I myself wrote one a while ago, but with no success.
debug {
release {
error("release set with debug!")
}
TARGET = app.bin
} else {
TARGET = app.dbg
}
This is a bit annoying. Apparently due to a bit of mess in the loaded
config files, or some problem in qtcreator, both debug and release flags
are set at the same time...
Don't use 'debug' and 'release' scopes. It's almost never what you need.
Instead use:

CONFIG(debug, debug|release) {
# That is the "debug" branch
TARGET = app.dbg
} else {
# That is the "release" branch
TARGET = app.bin
}

Andre'
paulo
2009-11-09 00:00:49 UTC
Permalink
Hi,

I was using that, but it has exactly the same effect.
Besides, the qmake tutorial page "says" to use debug {}, which I find
much more elegant.


Paulo
Post by Andre Poenitz
Don't use 'debug' and 'release' scopes. It's almost never what you need.
CONFIG(debug, debug|release) {
# That is the "debug" branch
TARGET = app.dbg
} else {
# That is the "release" branch
TARGET = app.bin
}
Andre'
_______________________________________________
Qt-creator mailing list
http://lists.trolltech.com/mailman/listinfo/qt-creator
Andre Poenitz
2009-11-08 16:50:04 UTC
Permalink
Post by paulo
Post by Andre Poenitz
Don't use 'debug' and 'release' scopes. It's almost never what you need.
CONFIG(debug, debug|release) {
# That is the "debug" branch
TARGET = app.dbg
} else {
# That is the "release" branch
TARGET = app.bin
}
I was using that, but it has exactly the same effect.
Hard to believe.
Post by paulo
Besides, the qmake tutorial page "says" to use debug {}, which I find
much more elegant.
It says "... when 'debug' is already on the CONFIG line". That's
different from "when you want a debug build".

As you noted, you might have both 'debug' and 'release' in CONFIG.

Andre'
paulo
2009-11-09 20:56:59 UTC
Permalink
Hi,

I would like some help on this issue.


Apparently using the debug directly wont work, but when I use:


CONFIG(debug, debug|release) {

CONFIG(release, debug|release) {

warning("release set with debug! Ignoring release.")

}

warning("Building debug.")

} else {

warning("Building release.")

}

it wont matter if I'm building for release or, because I'll get always:

Project WARNING: Building release.


So, what's the right way to do this?


Thanks
Paulo
André Pönitz
2009-11-09 12:07:15 UTC
Permalink
Post by paulo
Hi,
I would like some help on this issue.
CONFIG(debug, debug|release) {
CONFIG(release, debug|release) {
warning("release set with debug! Ignoring release.")
}
warning("Building debug.")
} else {
warning("Building release.")
}
Project WARNING: Building release.
So, what's the right way to do this?
The code you show is the right way to do this. If you get 'Building
release' twice there's

I am afraid you'll need to show a bit more context, at least all the
CONFIG settings in your .pro file and the qmake command line.

Andre'
Paulo Silva
2009-11-10 02:11:09 UTC
Permalink
Ok,

all the CONFIG settings in my .pro file are:

CONFIG(debug, debug|release) {

CONFIG(release, debug|release) {

warning("release set with debug! Ignoring release.")

}

warning("Building debug.")

TARGET = osgQtd

} else {

warning("Building release.")

TARGET = osgQt

}


The qmake command line (and output for a debug build):

/usr/bin/qmake -spec /usr/share/qt4/mkspecs/linux-g++ -unix -o Makefile
libosgQt.pro

Project WARNING: Building release.


So, I can't see nothing suspicious here.
What might be wrong?

Thank you
Paulo
Post by André Pönitz
Post by paulo
Hi,
I would like some help on this issue.
CONFIG(debug, debug|release) {
CONFIG(release, debug|release) {
warning("release set with debug! Ignoring release.")
}
warning("Building debug.")
} else {
warning("Building release.")
}
Project WARNING: Building release.
So, what's the right way to do this?
The code you show is the right way to do this. If you get 'Building
release' twice there's
I am afraid you'll need to show a bit more context, at least all the
CONFIG settings in your .pro file and the qmake command line.
Andre'
_______________________________________________
Qt-creator mailing list
http://lists.trolltech.com/mailman/listinfo/qt-creator
Paulo Silva
2009-11-10 02:23:38 UTC
Permalink
Well, it seems I was able to get it working.
I just need to once in a while delete the .user file.
When qtcreator starts behaving strangely, that is usually the source of the
problems.
Unfortunately it's a pain to have to add all the configs (program arguments,
shadow builds, dependencies) again...
But at least it works for now.

Thanks
Paulo
Post by Andre Poenitz
Ok,
CONFIG(debug, debug|release) {
CONFIG(release, debug|release) {
warning("release set with debug! Ignoring release.")
}
warning("Building debug.")
TARGET = osgQtd
} else {
warning("Building release.")
TARGET = osgQt
}
/usr/bin/qmake -spec /usr/share/qt4/mkspecs/linux-g++ -unix -o Makefile
libosgQt.pro
Project WARNING: Building release.
So, I can't see nothing suspicious here.
What might be wrong?
Thank you
Paulo
Post by André Pönitz
Post by paulo
Hi,
I would like some help on this issue.
CONFIG(debug, debug|release) {
CONFIG(release, debug|release) {
warning("release set with debug! Ignoring release.")
}
warning("Building debug.")
} else {
warning("Building release.")
}
Project WARNING: Building release.
So, what's the right way to do this?
The code you show is the right way to do this. If you get 'Building
release' twice there's
I am afraid you'll need to show a bit more context, at least all the
CONFIG settings in your .pro file and the qmake command line.
Andre'
_______________________________________________
Qt-creator mailing list
http://lists.trolltech.com/mailman/listinfo/qt-creator
Coda Highland
2009-11-10 02:52:05 UTC
Permalink
Post by Andre Poenitz
CONFIG(debug, debug|release) {
CONFIG(release, debug|release) {
warning("release set with debug! Ignoring release.")
}
This will never trigger. The two-parameter form of CONFIG() guarantees
that the two options are mutually exclusive, and whichever is declared
last wins. If the first conditional succeeds, the second one CANNOT
return true.

/s/ Adam

Loading...