Qbs: Make pass on cpp.defines correctly to the C++ code model

When passing -DFOO to the compiler it will treat that as similar
to "#define FOO 1". Do the same when passing FOO on to the code
model.

Task-number: QTCREATORBUG-13384
Change-Id: I236d4731435e0559f75a3435dad9a8d935d42042
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2014-11-13 12:16:25 +01:00
parent fae505193a
commit c4fb13a652

View File

@@ -727,6 +727,8 @@ void QbsProject::updateCppCodeModel()
int pos = data.indexOf('='); int pos = data.indexOf('=');
if (pos >= 0) if (pos >= 0)
data[pos] = ' '; data[pos] = ' ';
else
data.append(" 1"); // cpp.defines: [ "FOO" ] is considered to be "FOO=1"
grpDefines += (QByteArray("#define ") + data + '\n'); grpDefines += (QByteArray("#define ") + data + '\n');
} }
ppBuilder.setDefines(grpDefines); ppBuilder.setDefines(grpDefines);