CMakePM: Add supprot for CMakePresets version 3

This includes Condition and toolchainFile

https://cmake.org/cmake/help/v3.21/manual/cmake-presets.7.html

Task-number: QTCREATORBUG-24555
Change-Id: I1026390af67b2be1aa0c3b02b654fc19442d3c89
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2022-09-26 18:59:04 +02:00
parent 45a275e054
commit ee4c998ff3
7 changed files with 430 additions and 27 deletions

View File

@@ -43,6 +43,47 @@ public:
std::optional<bool> find = false;
};
class Condition {
public:
QString type;
bool isNull() const { return type == "null"; }
bool isConst() const { return type == "const"; }
bool isEquals() const { return type == "equals"; }
bool isNotEquals() const { return type == "notEquals"; }
bool isInList() const { return type == "inList"; }
bool isNotInList() const { return type == "notInList"; }
bool isMatches() const { return type == "matches"; }
bool isNotMatches() const { return type == "notMatches"; }
bool isAnyOf() const { return type == "anyOf"; }
bool isAllOf() const { return type == "allOf"; }
bool isNot() const { return type == "not"; }
bool evaluate() const;
// const
std::optional<bool> constValue;
// equals, notEquals
std::optional<QString> lhs;
std::optional<QString> rhs;
// inList, notInList
std::optional<QString> string;
std::optional<QStringList> list;
// matches, notMatches
std::optional<QString> regex;
using ConditionPtr = std::shared_ptr<Condition>;
// anyOf, allOf
std::optional<std::vector<ConditionPtr>> conditions;
// not
std::optional<ConditionPtr> condition;
};
class ConfigurePreset {
public:
void inheritFrom(const ConfigurePreset &other);
@@ -50,12 +91,14 @@ public:
QString name;
std::optional<bool> hidden = false;
std::optional<QStringList> inherits;
std::optional<Condition> condition;
std::optional<QHash<QString, QString>> vendor;
std::optional<QString> displayName;
std::optional<QString> description;
std::optional<QString> generator;
std::optional<ValueStrategyPair> architecture;
std::optional<ValueStrategyPair> toolset;
std::optional<QString> toolchainFile;
std::optional<QString> binaryDir;
std::optional<QString> cmakeExecutable;
std::optional<CMakeConfig> cacheVariables;
@@ -72,6 +115,7 @@ public:
QString name;
std::optional<bool> hidden = false;
std::optional<QStringList> inherits;
std::optional<Condition> condition;
std::optional<QHash<QString, QString>> vendor;
std::optional<QString> displayName;
std::optional<QString> description;