CMakePM: use string form for architecture / toolset preset fields

Documentation mentions:

"Each may be either a string or an object" and "If no strategy field is
given, or if the field uses the string form rather than the object form,
the behavior is the same as 'set'"

Task-number: QTCREATORBUG-28693
Change-Id: Idd8cdffb94e9a943e0b133a63c628d9d8d54eb20
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2023-07-05 14:53:50 +02:00
parent b4dd53f9fe
commit 6235d9b8cc

View File

@@ -296,6 +296,15 @@ bool parseConfigurePresets(const QJsonValue &jsonValue,
if (strategy == "external") if (strategy == "external")
preset.architecture->strategy preset.architecture->strategy
= PresetsDetails::ValueStrategyPair::Strategy::external; = PresetsDetails::ValueStrategyPair::Strategy::external;
} else {
preset.architecture->strategy = PresetsDetails::ValueStrategyPair::Strategy::set;
}
} else {
const QString value = object.value("architecture").toString();
if (!value.isEmpty()) {
preset.architecture = PresetsDetails::ValueStrategyPair();
preset.architecture->value = value;
preset.architecture->strategy = PresetsDetails::ValueStrategyPair::Strategy::set;
} }
} }
@@ -311,6 +320,15 @@ bool parseConfigurePresets(const QJsonValue &jsonValue,
preset.toolset->strategy = PresetsDetails::ValueStrategyPair::Strategy::set; preset.toolset->strategy = PresetsDetails::ValueStrategyPair::Strategy::set;
if (strategy == "external") if (strategy == "external")
preset.toolset->strategy = PresetsDetails::ValueStrategyPair::Strategy::external; preset.toolset->strategy = PresetsDetails::ValueStrategyPair::Strategy::external;
} else {
preset.toolset->strategy = PresetsDetails::ValueStrategyPair::Strategy::set;
}
} else {
const QString value = object.value("toolset").toString();
if (!value.isEmpty()) {
preset.toolset = PresetsDetails::ValueStrategyPair();
preset.toolset->value = value;
preset.toolset->strategy = PresetsDetails::ValueStrategyPair::Strategy::set;
} }
} }