summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-10-16 20:19:11 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-10-22 15:24:39 (GMT)
commit64afabdbcb265acb53a9b8f8cb86465d31f2ca61 (patch)
treeca2616a38a2bf7c80d8635d7fd0f2957645a0a45
parent609122007dc074739b394d2f70f674bbccca6073 (diff)
downloadCMake-64afabdbcb265acb53a9b8f8cb86465d31f2ca61.zip
CMake-64afabdbcb265acb53a9b8f8cb86465d31f2ca61.tar.gz
CMake-64afabdbcb265acb53a9b8f8cb86465d31f2ca61.tar.bz2
CMakePresets.json: Split cmakeGeneratorConfig field
Make this field separate for both architecture and toolset. Allow architecture and toolset to be either strings or objects with value and strategy fields. Fixes: #21317
-rw-r--r--Help/manual/cmake-presets.7.rst38
-rw-r--r--Help/manual/presets/schema.json60
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx4
-rw-r--r--Source/QtDialog/QCMake.cxx6
-rw-r--r--Source/QtDialog/QCMakePreset.cxx17
-rw-r--r--Source/QtDialog/QCMakePreset.h3
-rw-r--r--Source/cmCMakePresetsFile.cxx66
-rw-r--r--Source/cmCMakePresetsFile.h9
-rw-r--r--Source/cmake.cxx10
-rw-r--r--Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx6
-rw-r--r--Tests/CMakeGUI/QCMakePresetItemModelTest.cxx12
-rw-r--r--Tests/CMakeGUI/QCMakePresetTest.cxx11
-rw-r--r--Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-result.txt (renamed from Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-stderr.txt (renamed from Tests/RunCMake/CMakePresets/CMakeGeneratorConfigNone-stderr.txt)0
-rw-r--r--Tests/RunCMake/CMakePresets/ArchToolsetStrategyIgnore.cmake (renamed from Tests/RunCMake/CMakePresets/CMakeGeneratorConfigIgnore.cmake)0
-rw-r--r--Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-result.txt (renamed from Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-stderr.txt (renamed from Tests/RunCMake/CMakePresets/CMakeGeneratorConfigDefault-stderr.txt)0
-rw-r--r--Tests/RunCMake/CMakePresets/CMakePresets.json.in30
-rw-r--r--Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-result.txt (renamed from Tests/RunCMake/CMakePresets/CMakeGeneratorConfigNone-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy.json.in13
-rw-r--r--Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-result.txt (renamed from Tests/RunCMake/CMakePresets/CMakeGeneratorConfigDefault-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/InvalidToolsetStrategy.json.in (renamed from Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig.json.in)6
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy.json.in13
-rw-r--r--Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/UnknownToolsetStrategy.json.in (renamed from Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig.json.in)6
33 files changed, 241 insertions, 95 deletions
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst
index 7040ad5..e1b3749 100644
--- a/Help/manual/cmake-presets.7.rst
+++ b/Help/manual/cmake-presets.7.rst
@@ -130,34 +130,34 @@ Format
the ``architecture`` field instead.
``architecture``
+ ``toolset``
- An optional string representing the platform name to use for generators
- that support platforms.
+ Optional fields representing the platform and toolset, respectively, for
+ generators that support them. Each may be either a string or an object
+ with the following fields:
- ``toolset``
+ ``value``
- An optional string representing the toolset name to use for generators
- that support toolsets.
+ An optional string representing the value.
- ``cmakeGeneratorConfig``
+ ``strategy``
- An optional string telling CMake how to handle the ``architecture`` and
- ``toolset`` fields. Valid values are:
+ An optional string telling CMake how to handle the ``architecture`` or
+ ``toolset`` field. Valid values are:
- ``"default"``
+ ``"set"``
- Set the platform and toolset using the ``architecture`` and ``toolset``
- fields respectively. On non-Visual Studio generators, this will result
- in an error if ``architecture`` or ``toolset`` are set.
+ Set the respective value. This will result in an error for generators
+ that do not support the respective field.
- ``"ignore"``
+ ``"external"``
- Do not set the platform or toolset at all, even on Visual Studio
- generators. This is useful if, for example, a preset uses the Ninja
- generator, and an IDE knows how to set up the Visual C++ environment
- from the ``architecture`` and ``toolset`` fields. In that case, CMake
- will ignore ``architecture`` and ``toolset``, but the IDE can use them
- to set up the environment before invoking CMake.
+ Do not set the value, even if the generator supports it. This is
+ useful if, for example, a preset uses the Ninja generator, and an IDE
+ knows how to set up the Visual C++ environment from the
+ ``architecture`` and ``toolset`` fields. In that case, CMake will
+ ignore the field, but the IDE can use them to set up the environment
+ before invoking CMake.
``binaryDir``
diff --git a/Help/manual/presets/schema.json b/Help/manual/presets/schema.json
index ba4568f..57b063e 100644
--- a/Help/manual/presets/schema.json
+++ b/Help/manual/presets/schema.json
@@ -85,19 +85,57 @@
"description": "An optional string representing the generator to use for the preset. If generator is not specified, it must be inherited from the inherits preset (unless this preset is hidden). Note that for Visual Studio generators, unlike in the command line -G argument, you cannot include the platform name in the generator name. Use the architecture field instead."
},
"architecture": {
- "type": "string",
- "description": "An optional string representing the platform name to use for Visual Studio generators."
+ "anyOf": [
+ {
+ "type": "string",
+ "description": "An optional string representing the platform for generators that support it."
+ },
+ {
+ "type": "object",
+ "description": "An optional object representing the platform for generators that support it.",
+ "properties": {
+ "value": {
+ "type": "string",
+ "description": "An optional string representing the value."
+ },
+ "strategy": {
+ "type": "string",
+ "description": "An optional string telling CMake how to handle the field. Valid values are: \"set\" Set the respective value. This will result in an error for generators that do not support the respective field. \"external\" Do not set the value, even if the generator supports it. This is useful if, for example, a preset uses the Ninja generator, and an IDE knows how to set up the Visual C++ environment from the architecture and toolset fields. In that case, CMake will ignore the field, but the IDE can use them to set up the environment before invoking CMake.",
+ "enum": [
+ "set",
+ "external"
+ ]
+ }
+ },
+ "additionalProperties": false
+ }
+ ]
},
"toolset": {
- "type": "string",
- "description": "An optional string representing the toolset name to use for Visual Studio generators."
- },
- "cmakeGeneratorConfig": {
- "type": "string",
- "description": "An optional string telling CMake how to handle the architecture and toolset fields. Valid values are: \"default\": Set the platform and toolset using the architecture and toolset fields respectively. On non-Visual Studio generators, this will result in an error if architecture or toolset are set. \"ignore\": Do not set the platform or toolset at all, even on Visual Studio generators. This is useful if, for example, a preset uses the Ninja generator, and an IDE knows how to set up the Visual C++ environment from the architecture and toolset fields. In that case, CMake will ignore architecture and toolset, but the IDE can use them to set up the environment before invoking CMake.",
- "enum": [
- "default",
- "ignore"
+ "anyOf": [
+ {
+ "type": "string",
+ "description": "An optional string representing the toolset for generators that support it."
+ },
+ {
+ "type": "object",
+ "description": "An optional object representing the toolset for generators that support it.",
+ "properties": {
+ "value": {
+ "type": "string",
+ "description": "An optional string representing the value."
+ },
+ "strategy": {
+ "type": "string",
+ "description": "An optional string telling CMake how to handle the field. Valid values are: \"set\" Set the respective value. This will result in an error for generators that do not support the respective field. \"external\" Do not set the value, even if the generator supports it. This is useful if, for example, a preset uses the Ninja generator, and an IDE knows how to set up the Visual C++ environment from the architecture and toolset fields. In that case, CMake will ignore the field, but the IDE can use them to set up the environment before invoking CMake.",
+ "enum": [
+ "set",
+ "external"
+ ]
+ }
+ },
+ "additionalProperties": false
+ }
]
},
"binaryDir": {
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 7a04daa..a15614d 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -859,8 +859,10 @@ bool CMakeSetupDialog::setupFirstConfigure()
if (presetData.isValid()) {
auto preset = presetData.value<QCMakePreset>();
dialog.setCurrentGenerator(preset.generator);
- if (preset.setGenConfig) {
+ if (preset.setArchitecture) {
dialog.setPlatform(preset.architecture);
+ }
+ if (preset.setToolset) {
dialog.setToolset(preset.toolset);
}
dialog.setCompilerOption(CompilerOption::DefaultNative);
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 3789e93..2f41f70 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -551,9 +551,11 @@ void QCMake::loadPresets()
preset.generator = std::move(QString::fromLocal8Bit(p.Generator.data()));
preset.architecture =
std::move(QString::fromLocal8Bit(p.Architecture.data()));
+ preset.setArchitecture = !p.ArchitectureStrategy ||
+ p.ArchitectureStrategy == cmCMakePresetsFile::ArchToolsetStrategy::Set;
preset.toolset = std::move(QString::fromLocal8Bit(p.Toolset.data()));
- preset.setGenConfig = !p.GeneratorConfig ||
- p.GeneratorConfig == cmCMakePresetsFile::CMakeGeneratorConfig::Default;
+ preset.setToolset = !p.ToolsetStrategy ||
+ p.ToolsetStrategy == cmCMakePresetsFile::ArchToolsetStrategy::Set;
preset.enabled = it.Expanded &&
std::find_if(this->AvailableGenerators.begin(),
this->AvailableGenerators.end(),
diff --git a/Source/QtDialog/QCMakePreset.cxx b/Source/QtDialog/QCMakePreset.cxx
index b10cf07..176f532 100644
--- a/Source/QtDialog/QCMakePreset.cxx
+++ b/Source/QtDialog/QCMakePreset.cxx
@@ -6,8 +6,9 @@ bool operator==(const QCMakePreset& lhs, const QCMakePreset& rhs)
{
return lhs.name == rhs.name && lhs.displayName == rhs.displayName &&
lhs.description == rhs.description && lhs.generator == rhs.generator &&
- lhs.architecture == rhs.architecture && lhs.toolset == rhs.toolset &&
- lhs.setGenConfig == rhs.setGenConfig && lhs.enabled == rhs.enabled;
+ lhs.architecture == rhs.architecture &&
+ lhs.setArchitecture == rhs.setArchitecture && lhs.toolset == rhs.toolset &&
+ lhs.setToolset == rhs.setToolset && lhs.enabled == rhs.enabled;
}
bool operator!=(const QCMakePreset& lhs, const QCMakePreset& rhs)
@@ -27,11 +28,13 @@ bool operator<(const QCMakePreset& lhs, const QCMakePreset& rhs)
(lhs.generator == rhs.generator &&
(lhs.architecture < rhs.architecture ||
(lhs.architecture == rhs.architecture &&
- (lhs.toolset < rhs.toolset ||
- (lhs.toolset == rhs.toolset &&
- (lhs.setGenConfig < rhs.setGenConfig ||
- (lhs.setGenConfig == rhs.setGenConfig &&
- (lhs.enabled < rhs.enabled))))))))))))));
+ (lhs.setArchitecture < rhs.setArchitecture ||
+ (lhs.setArchitecture == rhs.setArchitecture &&
+ (lhs.toolset < rhs.toolset ||
+ (lhs.toolset == rhs.toolset &&
+ (lhs.setToolset < rhs.setToolset ||
+ (lhs.setToolset == rhs.setToolset &&
+ (lhs.enabled < rhs.enabled))))))))))))))));
}
bool operator<=(const QCMakePreset& lhs, const QCMakePreset& rhs)
diff --git a/Source/QtDialog/QCMakePreset.h b/Source/QtDialog/QCMakePreset.h
index 93d70d8..1609fcb 100644
--- a/Source/QtDialog/QCMakePreset.h
+++ b/Source/QtDialog/QCMakePreset.h
@@ -15,8 +15,9 @@ public:
QString description;
QString generator;
QString architecture;
+ bool setArchitecture;
QString toolset;
- bool setGenConfig;
+ bool setToolset;
bool enabled;
};
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx
index b3bb6df..34a313b 100644
--- a/Source/cmCMakePresetsFile.cxx
+++ b/Source/cmCMakePresetsFile.cxx
@@ -30,7 +30,7 @@ using ReadFileResult = cmCMakePresetsFile::ReadFileResult;
using CacheVariable = cmCMakePresetsFile::CacheVariable;
using UnexpandedPreset = cmCMakePresetsFile::UnexpandedPreset;
using ExpandedPreset = cmCMakePresetsFile::ExpandedPreset;
-using CMakeGeneratorConfig = cmCMakePresetsFile::CMakeGeneratorConfig;
+using ArchToolsetStrategy = cmCMakePresetsFile::ArchToolsetStrategy;
constexpr int MIN_VERSION = 1;
constexpr int MAX_VERSION = 1;
@@ -212,8 +212,8 @@ auto const PresetDebugHelper =
.Bind("find"_s, &UnexpandedPreset::DebugFind, PresetOptionalBoolHelper,
false);
-ReadFileResult CMakeGeneratorConfigHelper(
- cm::optional<CMakeGeneratorConfig>& out, const Json::Value* value)
+ReadFileResult ArchToolsetStrategyHelper(
+ cm::optional<ArchToolsetStrategy>& out, const Json::Value* value)
{
if (!value) {
out = cm::nullopt;
@@ -224,19 +224,56 @@ ReadFileResult CMakeGeneratorConfigHelper(
return ReadFileResult::INVALID_PRESET;
}
- if (value->asString() == "default") {
- out = CMakeGeneratorConfig::Default;
+ if (value->asString() == "set") {
+ out = ArchToolsetStrategy::Set;
return ReadFileResult::READ_OK;
}
- if (value->asString() == "ignore") {
- out = CMakeGeneratorConfig::Ignore;
+ if (value->asString() == "external") {
+ out = ArchToolsetStrategy::External;
return ReadFileResult::READ_OK;
}
return ReadFileResult::INVALID_PRESET;
}
+std::function<ReadFileResult(UnexpandedPreset&, const Json::Value*)>
+ArchToolsetHelper(
+ std::string UnexpandedPreset::*valueField,
+ cm::optional<ArchToolsetStrategy> UnexpandedPreset::*strategyField)
+{
+ auto const objectHelper =
+ cmJSONObjectHelper<UnexpandedPreset, ReadFileResult>(
+ ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
+ .Bind("value", valueField, PresetStringHelper, false)
+ .Bind("strategy", strategyField, ArchToolsetStrategyHelper, false);
+ return [valueField, strategyField, objectHelper](
+ UnexpandedPreset& out, const Json::Value* value) -> ReadFileResult {
+ if (!value) {
+ (out.*valueField).clear();
+ out.*strategyField = cm::nullopt;
+ return ReadFileResult::READ_OK;
+ }
+
+ if (value->isString()) {
+ out.*valueField = value->asString();
+ out.*strategyField = cm::nullopt;
+ return ReadFileResult::READ_OK;
+ }
+
+ if (value->isObject()) {
+ return objectHelper(out, value);
+ }
+
+ return ReadFileResult::INVALID_PRESET;
+ };
+}
+
+auto const ArchitectureHelper = ArchToolsetHelper(
+ &UnexpandedPreset::Architecture, &UnexpandedPreset::ArchitectureStrategy);
+auto const ToolsetHelper = ArchToolsetHelper(
+ &UnexpandedPreset::Toolset, &UnexpandedPreset::ToolsetStrategy);
+
auto const PresetHelper =
cmJSONObjectHelper<UnexpandedPreset, ReadFileResult>(
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
@@ -252,11 +289,8 @@ auto const PresetHelper =
false)
.Bind("generator"_s, &UnexpandedPreset::Generator, PresetStringHelper,
false)
- .Bind("architecture"_s, &UnexpandedPreset::Architecture,
- PresetStringHelper, false)
- .Bind("toolset"_s, &UnexpandedPreset::Toolset, PresetStringHelper, false)
- .Bind("cmakeGeneratorConfig"_s, &UnexpandedPreset::GeneratorConfig,
- CMakeGeneratorConfigHelper, false)
+ .Bind("architecture"_s, ArchitectureHelper, false)
+ .Bind("toolset"_s, ToolsetHelper, false)
.Bind("binaryDir"_s, &UnexpandedPreset::BinaryDir, PresetStringHelper,
false)
.Bind<std::string>("cmakeExecutable"_s, nullptr, PresetStringHelper, false)
@@ -353,8 +387,12 @@ ReadFileResult VisitPreset(
InheritString(preset.Generator, parent->second.Unexpanded.Generator);
InheritString(preset.Architecture, parent->second.Unexpanded.Architecture);
InheritString(preset.Toolset, parent->second.Unexpanded.Toolset);
- if (!preset.GeneratorConfig) {
- preset.GeneratorConfig = parent->second.Unexpanded.GeneratorConfig;
+ if (!preset.ArchitectureStrategy) {
+ preset.ArchitectureStrategy =
+ parent->second.Unexpanded.ArchitectureStrategy;
+ }
+ if (!preset.ToolsetStrategy) {
+ preset.ToolsetStrategy = parent->second.Unexpanded.ToolsetStrategy;
}
InheritString(preset.BinaryDir, parent->second.Unexpanded.BinaryDir);
InheritOptionalBool(preset.WarnDev, parent->second.Unexpanded.WarnDev);
diff --git a/Source/cmCMakePresetsFile.h b/Source/cmCMakePresetsFile.h
index 87797d7..f6b159a 100644
--- a/Source/cmCMakePresetsFile.h
+++ b/Source/cmCMakePresetsFile.h
@@ -12,10 +12,10 @@
class cmCMakePresetsFile
{
public:
- enum class CMakeGeneratorConfig
+ enum class ArchToolsetStrategy
{
- Default,
- Ignore,
+ Set,
+ External,
};
class CacheVariable
@@ -50,8 +50,9 @@ public:
std::string Description;
std::string Generator;
std::string Architecture;
+ cm::optional<ArchToolsetStrategy> ArchitectureStrategy;
std::string Toolset;
- cm::optional<CMakeGeneratorConfig> GeneratorConfig;
+ cm::optional<ArchToolsetStrategy> ToolsetStrategy;
std::string BinaryDir;
std::map<std::string, cm::optional<CacheVariable>> CacheVariables;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 5b6bd1e..291ce22 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1069,12 +1069,16 @@ void cmake::SetArgs(const std::vector<std::string>& args)
this->UnprocessedPresetVariables = expandedPreset->CacheVariables;
this->UnprocessedPresetEnvironment = expandedPreset->Environment;
- if (!expandedPreset->GeneratorConfig ||
- expandedPreset->GeneratorConfig ==
- cmCMakePresetsFile::CMakeGeneratorConfig::Default) {
+ if (!expandedPreset->ArchitectureStrategy ||
+ expandedPreset->ArchitectureStrategy ==
+ cmCMakePresetsFile::ArchToolsetStrategy::Set) {
if (!this->GeneratorPlatformSet) {
this->SetGeneratorPlatform(expandedPreset->Architecture);
}
+ }
+ if (!expandedPreset->ToolsetStrategy ||
+ expandedPreset->ToolsetStrategy ==
+ cmCMakePresetsFile::ArchToolsetStrategy::Set) {
if (!this->GeneratorToolsetSet) {
this->SetGeneratorToolset(expandedPreset->Toolset);
}
diff --git a/Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx b/Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx
index 6ee55c3..a95d008 100644
--- a/Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx
+++ b/Tests/CMakeGUI/QCMakePresetComboBoxTest.cxx
@@ -24,8 +24,9 @@ void QCMakePresetComboBoxTest::changePresets()
/*description=*/"",
/*generator=*/"Ninja",
/*architecture=*/"",
+ /*setArchitecture=*/true,
/*toolset=*/"",
- /*setGenConfig=*/true,
+ /*setToolset=*/true,
/*enabled=*/true,
},
});
@@ -48,8 +49,9 @@ void QCMakePresetComboBoxTest::changePresets()
/*description=*/"",
/*generator=*/"Ninja Multi-Config",
/*architecture=*/"",
+ /*setArchitecture=*/true,
/*toolset=*/"",
- /*setGenConfig=*/true,
+ /*setToolset=*/true,
/*enabled=*/true,
},
});
diff --git a/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx b/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx
index ee45d39..97dbb30 100644
--- a/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx
+++ b/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx
@@ -32,8 +32,9 @@ void QCMakePresetItemModelTest::initTestCase_data()
/*description=*/"",
/*generator=*/"",
/*architecture=*/"",
+ /*setArchitecture=*/true,
/*toolset=*/"",
- /*setGenConfig=*/true,
+ /*setToolset=*/true,
/*enabled=*/true,
},
QCMakePreset{
@@ -42,8 +43,9 @@ void QCMakePresetItemModelTest::initTestCase_data()
/*description=*/"",
/*generator=*/"",
/*architecture=*/"",
+ /*setArchitecture=*/true,
/*toolset=*/"",
- /*setGenConfig=*/true,
+ /*setToolset=*/true,
/*enabled=*/true,
},
QCMakePreset{
@@ -52,8 +54,9 @@ void QCMakePresetItemModelTest::initTestCase_data()
/*description=*/"Long Description",
/*generator=*/"",
/*architecture=*/"",
+ /*setArchitecture=*/true,
/*toolset=*/"",
- /*setGenConfig=*/true,
+ /*setToolset=*/true,
/*enabled=*/true,
},
QCMakePreset{
@@ -62,8 +65,9 @@ void QCMakePresetItemModelTest::initTestCase_data()
/*description=*/"",
/*generator=*/"",
/*architecture=*/"",
+ /*setArchitecture=*/true,
/*toolset=*/"",
- /*setGenConfig=*/true,
+ /*setToolset=*/true,
/*enabled=*/false,
},
};
diff --git a/Tests/CMakeGUI/QCMakePresetTest.cxx b/Tests/CMakeGUI/QCMakePresetTest.cxx
index 8fd07e7..2081055 100644
--- a/Tests/CMakeGUI/QCMakePresetTest.cxx
+++ b/Tests/CMakeGUI/QCMakePresetTest.cxx
@@ -16,8 +16,9 @@ QCMakePreset makePreset()
/*description=*/"description",
/*generator=*/"generator",
/*architecture=*/"architecture",
+ /*setArchitecture=*/true,
/*toolset=*/"toolset",
- /*setGenConfig=*/true,
+ /*setToolset=*/true,
/*enabled=*/true,
};
}
@@ -69,12 +70,14 @@ void QCMakePresetTest::equality_data()
QTest::newRow("architecture")
<< makePreset(&QCMakePreset::architecture, "other-architecture") << false
<< true << false;
+ QTest::newRow("setArchitecture")
+ << makePreset(&QCMakePreset::setArchitecture, false) << false << false
+ << true;
QTest::newRow("toolset") << makePreset(&QCMakePreset::toolset,
"other-toolset")
<< false << false << true;
- QTest::newRow("setGenConfig")
- << makePreset(&QCMakePreset::setGenConfig, false) << false << false
- << true;
+ QTest::newRow("setToolset")
+ << makePreset(&QCMakePreset::setToolset, false) << false << false << true;
QTest::newRow("enabled") << makePreset(&QCMakePreset::enabled, false)
<< false << false << true;
}
diff --git a/Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig-result.txt b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig-result.txt
+++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-result.txt
diff --git a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigNone-stderr.txt b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-stderr.txt
index a3b79b6..a3b79b6 100644
--- a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigNone-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyDefault-stderr.txt
diff --git a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigIgnore.cmake b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyIgnore.cmake
index e69de29..e69de29 100644
--- a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigIgnore.cmake
+++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyIgnore.cmake
diff --git a/Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig-result.txt b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig-result.txt
+++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-result.txt
diff --git a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigDefault-stderr.txt b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-stderr.txt
index a3b79b6..a3b79b6 100644
--- a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigDefault-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/ArchToolsetStrategyNone-stderr.txt
diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
index ea7df45..0026380 100644
--- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in
+++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
@@ -451,28 +451,38 @@
"binaryDir": "${sourceDir}/build"
},
{
- "name": "CMakeGeneratorConfigNone",
+ "name": "ArchToolsetStrategyNone",
"generator": "@RunCMake_GENERATOR@",
"architecture": "a",
"toolset": "a",
"binaryDir": "${sourceDir}/build"
},
{
- "name": "CMakeGeneratorConfigBase",
+ "name": "ArchToolsetStrategyBase",
"generator": "@RunCMake_GENERATOR@",
- "architecture": "a",
- "toolset": "a",
- "cmakeGeneratorConfig": "ignore",
+ "architecture": {
+ "value": "a",
+ "strategy": "external"
+ },
+ "toolset": {
+ "value": "a",
+ "strategy": "external"
+ },
"binaryDir": "${sourceDir}/build"
},
{
- "name": "CMakeGeneratorConfigDefault",
- "inherits": "CMakeGeneratorConfigBase",
- "cmakeGeneratorConfig": "default"
+ "name": "ArchToolsetStrategyDefault",
+ "inherits": "ArchToolsetStrategyBase",
+ "architecture": {
+ "strategy": "set"
+ },
+ "toolset": {
+ "strategy": "set"
+ }
},
{
- "name": "CMakeGeneratorConfigIgnore",
- "inherits": "CMakeGeneratorConfigBase"
+ "name": "ArchToolsetStrategyIgnore",
+ "inherits": "ArchToolsetStrategyBase"
}
]
}
diff --git a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigNone-result.txt b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigNone-result.txt
+++ b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-result.txt
diff --git a/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-stderr.txt
new file mode 100644
index 0000000..4a4d4ce
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy: Invalid preset$
diff --git a/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy.json.in b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy.json.in
new file mode 100644
index 0000000..9ec2cee
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy.json.in
@@ -0,0 +1,13 @@
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "InvalidArchitectureStrategy",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "architecture": {
+ "strategy": {}
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig-stderr.txt
deleted file mode 100644
index 72a20d5..0000000
--- a/Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-^CMake Error: Could not read presets from [^
-]*/Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig: Invalid preset$
diff --git a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigDefault-result.txt b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/CMakePresets/CMakeGeneratorConfigDefault-result.txt
+++ b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-result.txt
diff --git a/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-stderr.txt
new file mode 100644
index 0000000..fab3766
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy: Invalid preset$
diff --git a/Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig.json.in b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy.json.in
index 1479c66..7d2ab1f 100644
--- a/Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig.json.in
+++ b/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy.json.in
@@ -2,10 +2,12 @@
"version": 1,
"configurePresets": [
{
- "name": "InvalidCMakeGeneratorConfig",
+ "name": "InvalidToolsetStrategy",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build",
- "cmakeGeneratorConfig": {}
+ "toolset": {
+ "strategy": {}
+ }
}
]
}
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index dddf05f..bd84510 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -117,8 +117,10 @@ run_cmake_presets(InvalidInheritance)
run_cmake_presets(ErrorNoWarningDev)
run_cmake_presets(ErrorNoWarningDeprecated)
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
-run_cmake_presets(InvalidCMakeGeneratorConfig)
-run_cmake_presets(UnknownCMakeGeneratorConfig)
+run_cmake_presets(InvalidArchitectureStrategy)
+run_cmake_presets(UnknownArchitectureStrategy)
+run_cmake_presets(InvalidToolsetStrategy)
+run_cmake_presets(UnknownToolsetStrategy)
run_cmake_presets(EmptyCacheKey)
run_cmake_presets(EmptyEnvKey)
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
@@ -196,9 +198,9 @@ if(RunCMake_GENERATOR MATCHES "^Visual Studio ")
run_cmake_presets(VisualStudioInheritanceMultiSecond)
endif()
else()
- run_cmake_presets(CMakeGeneratorConfigNone)
- run_cmake_presets(CMakeGeneratorConfigDefault)
- run_cmake_presets(CMakeGeneratorConfigIgnore)
+ run_cmake_presets(ArchToolsetStrategyNone)
+ run_cmake_presets(ArchToolsetStrategyDefault)
+ run_cmake_presets(ArchToolsetStrategyIgnore)
endif()
# Test bad command line arguments
diff --git a/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-result.txt b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-stderr.txt b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-stderr.txt
new file mode 100644
index 0000000..cf17881
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy: Invalid preset$
diff --git a/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy.json.in b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy.json.in
new file mode 100644
index 0000000..a3bf7c8
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy.json.in
@@ -0,0 +1,13 @@
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "UnknownArchitectureStrategy",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "architecture": {
+ "strategy": "unknown"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig-stderr.txt b/Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig-stderr.txt
deleted file mode 100644
index b1759b0..0000000
--- a/Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-^CMake Error: Could not read presets from [^
-]*/Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig: Invalid preset$
diff --git a/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-result.txt b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-stderr.txt b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-stderr.txt
new file mode 100644
index 0000000..8f9be29
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy: Invalid preset$
diff --git a/Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig.json.in b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy.json.in
index 900c6df..1668700 100644
--- a/Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig.json.in
+++ b/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy.json.in
@@ -2,10 +2,12 @@
"version": 1,
"configurePresets": [
{
- "name": "UnknownCMakeGeneratorConfig",
+ "name": "UnknownToolsetStrategy",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build",
- "cmakeGeneratorConfig": "unknown"
+ "toolset": {
+ "strategy": "unknown"
+ }
}
]
}