forked from qt-creator/qt-creator
CMake: Make it easier to get the expanded value of a CMake configuration
Change-Id: If289c48ef4ec2815e8bd12e08b990d1dc809c524 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -81,7 +81,7 @@ static QStringList toArguments(const CMakeConfig &config, const ProjectExplorer:
|
||||
a.append(QLatin1String(":INTERNAL="));
|
||||
break;
|
||||
}
|
||||
a.append(QString::fromUtf8(k->macroExpander()->expand(i.value)));
|
||||
a.append(i.expandedValue(k));
|
||||
|
||||
return a;
|
||||
});
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
#include "cmakeconfigitem.h"
|
||||
|
||||
#include <projectexplorer/kit.h>
|
||||
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QString>
|
||||
@@ -60,6 +63,11 @@ QByteArray CMakeConfigItem::valueOf(const QByteArray &key, const QList<CMakeConf
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QString CMakeConfigItem::expandedValue(const ProjectExplorer::Kit *k) const
|
||||
{
|
||||
return k->macroExpander()->expand(QString::fromUtf8(value));
|
||||
}
|
||||
|
||||
std::function<bool (const CMakeConfigItem &a, const CMakeConfigItem &b)> CMakeConfigItem::sortOperator()
|
||||
{
|
||||
return [](const CMakeConfigItem &a, const CMakeConfigItem &b) { return a.key < b.key; };
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace ProjectExplorer { class Kit; }
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
class CMakeConfigItem {
|
||||
@@ -44,6 +46,8 @@ public:
|
||||
|
||||
bool isNull() const { return key.isEmpty(); }
|
||||
|
||||
QString expandedValue(const ProjectExplorer::Kit *k) const;
|
||||
|
||||
static std::function<bool(const CMakeConfigItem &a, const CMakeConfigItem &b)> sortOperator();
|
||||
static CMakeConfigItem fromString(const QString &s);
|
||||
QString toString() const;
|
||||
|
||||
Reference in New Issue
Block a user