Commit cc909089 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

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's avatarTim Jenssen <tim.jenssen@qt.io>
parent 1f1ee1ec
......@@ -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
......
......@@ -54,7 +54,7 @@ public:
static std::function<bool(const CMakeConfigItem &a, const CMakeConfigItem &b)> sortOperator();
static CMakeConfigItem fromString(const QString &s);
QString toString() const;
QString toString(const Utils::MacroExpander *expander = nullptr) const;
bool operator==(const CMakeConfigItem &o) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment