forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <utils/theme/theme.h>
|
#include <utils/theme/theme.h>
|
||||||
#include <proparser/prowriter.h>
|
#include <proparser/prowriter.h>
|
||||||
@@ -1549,14 +1550,21 @@ QByteArray QmakeProFileNode::cxxDefines() const
|
|||||||
{
|
{
|
||||||
QByteArray result;
|
QByteArray result;
|
||||||
foreach (const QString &def, variableValue(DefinesVar)) {
|
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 ";
|
result += "#define ";
|
||||||
const int index = def.indexOf(QLatin1Char('='));
|
const QString defInterpreted = args.first();
|
||||||
|
const int index = defInterpreted.indexOf(QLatin1Char('='));
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
result += def.toLatin1();
|
result += defInterpreted.toLatin1();
|
||||||
result += " 1\n";
|
result += " 1\n";
|
||||||
} else {
|
} else {
|
||||||
const QString name = def.left(index);
|
const QString name = defInterpreted.left(index);
|
||||||
const QString value = def.mid(index + 1);
|
const QString value = defInterpreted.mid(index + 1);
|
||||||
result += name.toLatin1();
|
result += name.toLatin1();
|
||||||
result += ' ';
|
result += ' ';
|
||||||
result += value.toLocal8Bit();
|
result += value.toLocal8Bit();
|
||||||
|
Reference in New Issue
Block a user