forked from qt-creator/qt-creator
CMake: CMakeConfigItem uses macroexpander when turning into String
Make CMakeConfigItem use an (optional) macroexpander when asked to turn a CMakeConfigItem into a string. Change-Id: I7189fc4e5189d86809d002be3951934c37d98f12 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -214,7 +214,7 @@ CMakeConfigItem CMakeConfigItem::fromString(const QString &s)
|
||||
return item;
|
||||
}
|
||||
|
||||
QString CMakeConfigItem::toString() const
|
||||
QString CMakeConfigItem::toString(const Utils::MacroExpander *expander) const
|
||||
{
|
||||
if (key.isEmpty() || type == CMakeProjectManager::CMakeConfigItem::STATIC)
|
||||
return QString();
|
||||
@@ -240,7 +240,9 @@ QString CMakeConfigItem::toString() const
|
||||
break;
|
||||
}
|
||||
|
||||
return QString::fromUtf8(key) + QLatin1Char(':') + typeStr + QLatin1Char('=') + QString::fromUtf8(value);
|
||||
const QString expandedValue
|
||||
= expander ? expander->expand(QString::fromUtf8(value)) : QString::fromUtf8(value);
|
||||
return QString::fromUtf8(key) + QLatin1Char(':') + typeStr + QLatin1Char('=') + expandedValue;
|
||||
}
|
||||
|
||||
bool CMakeConfigItem::operator==(const CMakeConfigItem &o) const
|
||||
|
||||
Reference in New Issue
Block a user