summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2014-11-03 12:29:43 +0100
committerNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-02-12 10:38:06 +0000
commite9b94c131c77cb8182e3f4e5c59eaff081bb68a8 (patch)
tree8a0b1785c913afc2adb56855074192ced7a0048a /src
parent9df463da848b1d9cff6900594afa6855d10f39ae (diff)
downloadqt-creator-e9b94c131c77cb8182e3f4e5c59eaff081bb68a8.tar.gz
QmakeProjectManager: Shell-interpret project defines
...since they are meant to end up in Makefiles. A define like DEFINES += SRCDIR=\\\"$$PWD\\\" was passed on to the code model as #define SRCDIR \"/tmp/dir\" instead of #define SRCDIR "/tmp/dir" Change-Id: I7af5c8d82b3b937ca9db70f6580bab3419fb4550 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
index f939cd1a9a..b793232359 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
@@ -61,6 +61,7 @@
#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
+#include <utils/qtcprocess.h>
#include <utils/stringutils.h>
#include <utils/theme/theme.h>
#include <proparser/prowriter.h>
@@ -1549,14 +1550,21 @@ QByteArray QmakeProFileNode::cxxDefines() const
{
QByteArray result;
foreach (const QString &def, variableValue(DefinesVar)) {
+ // 'def' is shell input, so interpret it.
+ QtcProcess::SplitError error = QtcProcess::SplitOk;
+ const QStringList args = QtcProcess::splitArgs(def, HostOsInfo::hostOs(), false, &error);
+ if (error != QtcProcess::SplitOk || args.size() == 0)
+ continue;
+
result += "#define ";
- const int index = def.indexOf(QLatin1Char('='));
+ const QString defInterpreted = args.first();
+ const int index = defInterpreted.indexOf(QLatin1Char('='));
if (index == -1) {
- result += def.toLatin1();
+ result += defInterpreted.toLatin1();
result += " 1\n";
} else {
- const QString name = def.left(index);
- const QString value = def.mid(index + 1);
+ const QString name = defInterpreted.left(index);
+ const QString value = defInterpreted.mid(index + 1);
result += name.toLatin1();
result += ' ';
result += value.toLocal8Bit();