In this qmake code:
MY_COMPILER = mingw
warning($$MY_COMPILER)
contains(MY_COMPILER, mingw)
{
INCLUDEPATH += ../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0/src
DEPENDPATH += ../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0/src
QMAKE_RPATHDIR *= ../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0/lib
contains(QWT_CONFIG, QwtFramework) {
LIBS += -F../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0/lib
}
else {
LIBS += -L../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0/lib
}
IPATH = ../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0/src
warning(Using MinGW compiler)
}
else {
INCLUDEPATH += ../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0-intel-shared/src
DEPENDPATH += ../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0-intel-shared/src
QMAKE_RPATHDIR *= ../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0-intel-shared/lib
contains(QWT_CONFIG, QwtFramework) {
LIBS += -F../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0-intel-shared/lib
}
else {
LIBS += -L../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0-intel-shared/lib
}
IPATH = ../../libsrc/Qwt/qwt-6.0.1-win-Qt-4.8.0-intel-shared/src
warning(Using Intel compiler)
}
Whatever I define for the variable MY_COMPILER, it keeps taking the first condition, whilst it posts through the warning at line 3 the correct variable I entered.
How can I post a variable and then check whether it's defined?
Any efforts are highly appreciated.
Thanks.
I don't see anything wrong with your code, but you could try it this way instead:
CONFIG += mingw
mingw {
//...
} else {
//...
}
EDIT:
Another thing you could try is have the condition and opening curly bracket in the same line, if I remember right, that caused some problems in the past.
Then the statement would look like this:
contains(MY_COMPILER, mingw) {
//...
} else {
//...
}