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
This commit is contained in:
Kyle Edwards
2020-10-16 16:19:11 -04:00
parent 609122007d
commit 64afabdbcb
33 changed files with 242 additions and 96 deletions

View File

@@ -130,34 +130,34 @@ Format
the ``architecture`` field instead. the ``architecture`` field instead.
``architecture`` ``architecture``
An optional string representing the platform name to use for generators
that support platforms.
``toolset`` ``toolset``
An optional string representing the toolset name to use for generators Optional fields representing the platform and toolset, respectively, for
that support toolsets. generators that support them. Each may be either a string or an object
with the following fields:
``cmakeGeneratorConfig`` ``value``
An optional string telling CMake how to handle the ``architecture`` and An optional string representing the value.
``toolset`` fields. Valid values are:
``"default"`` ``strategy``
Set the platform and toolset using the ``architecture`` and ``toolset`` An optional string telling CMake how to handle the ``architecture`` or
fields respectively. On non-Visual Studio generators, this will result ``toolset`` field. Valid values are:
in an error if ``architecture`` or ``toolset`` are set.
``"ignore"`` ``"set"``
Do not set the platform or toolset at all, even on Visual Studio Set the respective value. This will result in an error for generators
generators. This is useful if, for example, a preset uses the Ninja that do not support the respective field.
generator, and an IDE knows how to set up the Visual C++ environment
from the ``architecture`` and ``toolset`` fields. In that case, CMake ``"external"``
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`` ``binaryDir``

View File

@@ -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." "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": { "architecture": {
"type": "string", "anyOf": [
"description": "An optional string representing the platform name to use for Visual Studio generators." {
"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": { "toolset": {
"type": "string", "anyOf": [
"description": "An optional string representing the toolset name to use for Visual Studio generators." {
}, "type": "string",
"cmakeGeneratorConfig": { "description": "An optional string representing the toolset for generators that support it."
"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": [ "type": "object",
"default", "description": "An optional object representing the toolset for generators that support it.",
"ignore" "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": { "binaryDir": {

View File

@@ -859,8 +859,10 @@ bool CMakeSetupDialog::setupFirstConfigure()
if (presetData.isValid()) { if (presetData.isValid()) {
auto preset = presetData.value<QCMakePreset>(); auto preset = presetData.value<QCMakePreset>();
dialog.setCurrentGenerator(preset.generator); dialog.setCurrentGenerator(preset.generator);
if (preset.setGenConfig) { if (preset.setArchitecture) {
dialog.setPlatform(preset.architecture); dialog.setPlatform(preset.architecture);
}
if (preset.setToolset) {
dialog.setToolset(preset.toolset); dialog.setToolset(preset.toolset);
} }
dialog.setCompilerOption(CompilerOption::DefaultNative); dialog.setCompilerOption(CompilerOption::DefaultNative);

View File

@@ -551,9 +551,11 @@ void QCMake::loadPresets()
preset.generator = std::move(QString::fromLocal8Bit(p.Generator.data())); preset.generator = std::move(QString::fromLocal8Bit(p.Generator.data()));
preset.architecture = preset.architecture =
std::move(QString::fromLocal8Bit(p.Architecture.data())); 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.toolset = std::move(QString::fromLocal8Bit(p.Toolset.data()));
preset.setGenConfig = !p.GeneratorConfig || preset.setToolset = !p.ToolsetStrategy ||
p.GeneratorConfig == cmCMakePresetsFile::CMakeGeneratorConfig::Default; p.ToolsetStrategy == cmCMakePresetsFile::ArchToolsetStrategy::Set;
preset.enabled = it.Expanded && preset.enabled = it.Expanded &&
std::find_if(this->AvailableGenerators.begin(), std::find_if(this->AvailableGenerators.begin(),
this->AvailableGenerators.end(), this->AvailableGenerators.end(),

View File

@@ -6,8 +6,9 @@ bool operator==(const QCMakePreset& lhs, const QCMakePreset& rhs)
{ {
return lhs.name == rhs.name && lhs.displayName == rhs.displayName && return lhs.name == rhs.name && lhs.displayName == rhs.displayName &&
lhs.description == rhs.description && lhs.generator == rhs.generator && lhs.description == rhs.description && lhs.generator == rhs.generator &&
lhs.architecture == rhs.architecture && lhs.toolset == rhs.toolset && lhs.architecture == rhs.architecture &&
lhs.setGenConfig == rhs.setGenConfig && lhs.enabled == rhs.enabled; lhs.setArchitecture == rhs.setArchitecture && lhs.toolset == rhs.toolset &&
lhs.setToolset == rhs.setToolset && lhs.enabled == rhs.enabled;
} }
bool operator!=(const QCMakePreset& lhs, const QCMakePreset& rhs) 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.generator == rhs.generator &&
(lhs.architecture < rhs.architecture || (lhs.architecture < rhs.architecture ||
(lhs.architecture == rhs.architecture && (lhs.architecture == rhs.architecture &&
(lhs.toolset < rhs.toolset || (lhs.setArchitecture < rhs.setArchitecture ||
(lhs.toolset == rhs.toolset && (lhs.setArchitecture == rhs.setArchitecture &&
(lhs.setGenConfig < rhs.setGenConfig || (lhs.toolset < rhs.toolset ||
(lhs.setGenConfig == rhs.setGenConfig && (lhs.toolset == rhs.toolset &&
(lhs.enabled < rhs.enabled)))))))))))))); (lhs.setToolset < rhs.setToolset ||
(lhs.setToolset == rhs.setToolset &&
(lhs.enabled < rhs.enabled))))))))))))))));
} }
bool operator<=(const QCMakePreset& lhs, const QCMakePreset& rhs) bool operator<=(const QCMakePreset& lhs, const QCMakePreset& rhs)

View File

@@ -15,8 +15,9 @@ public:
QString description; QString description;
QString generator; QString generator;
QString architecture; QString architecture;
bool setArchitecture;
QString toolset; QString toolset;
bool setGenConfig; bool setToolset;
bool enabled; bool enabled;
}; };

View File

@@ -30,7 +30,7 @@ using ReadFileResult = cmCMakePresetsFile::ReadFileResult;
using CacheVariable = cmCMakePresetsFile::CacheVariable; using CacheVariable = cmCMakePresetsFile::CacheVariable;
using UnexpandedPreset = cmCMakePresetsFile::UnexpandedPreset; using UnexpandedPreset = cmCMakePresetsFile::UnexpandedPreset;
using ExpandedPreset = cmCMakePresetsFile::ExpandedPreset; using ExpandedPreset = cmCMakePresetsFile::ExpandedPreset;
using CMakeGeneratorConfig = cmCMakePresetsFile::CMakeGeneratorConfig; using ArchToolsetStrategy = cmCMakePresetsFile::ArchToolsetStrategy;
constexpr int MIN_VERSION = 1; constexpr int MIN_VERSION = 1;
constexpr int MAX_VERSION = 1; constexpr int MAX_VERSION = 1;
@@ -212,8 +212,8 @@ auto const PresetDebugHelper =
.Bind("find"_s, &UnexpandedPreset::DebugFind, PresetOptionalBoolHelper, .Bind("find"_s, &UnexpandedPreset::DebugFind, PresetOptionalBoolHelper,
false); false);
ReadFileResult CMakeGeneratorConfigHelper( ReadFileResult ArchToolsetStrategyHelper(
cm::optional<CMakeGeneratorConfig>& out, const Json::Value* value) cm::optional<ArchToolsetStrategy>& out, const Json::Value* value)
{ {
if (!value) { if (!value) {
out = cm::nullopt; out = cm::nullopt;
@@ -224,19 +224,56 @@ ReadFileResult CMakeGeneratorConfigHelper(
return ReadFileResult::INVALID_PRESET; return ReadFileResult::INVALID_PRESET;
} }
if (value->asString() == "default") { if (value->asString() == "set") {
out = CMakeGeneratorConfig::Default; out = ArchToolsetStrategy::Set;
return ReadFileResult::READ_OK; return ReadFileResult::READ_OK;
} }
if (value->asString() == "ignore") { if (value->asString() == "external") {
out = CMakeGeneratorConfig::Ignore; out = ArchToolsetStrategy::External;
return ReadFileResult::READ_OK; return ReadFileResult::READ_OK;
} }
return ReadFileResult::INVALID_PRESET; 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 = auto const PresetHelper =
cmJSONObjectHelper<UnexpandedPreset, ReadFileResult>( cmJSONObjectHelper<UnexpandedPreset, ReadFileResult>(
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false) ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
@@ -252,11 +289,8 @@ auto const PresetHelper =
false) false)
.Bind("generator"_s, &UnexpandedPreset::Generator, PresetStringHelper, .Bind("generator"_s, &UnexpandedPreset::Generator, PresetStringHelper,
false) false)
.Bind("architecture"_s, &UnexpandedPreset::Architecture, .Bind("architecture"_s, ArchitectureHelper, false)
PresetStringHelper, false) .Bind("toolset"_s, ToolsetHelper, false)
.Bind("toolset"_s, &UnexpandedPreset::Toolset, PresetStringHelper, false)
.Bind("cmakeGeneratorConfig"_s, &UnexpandedPreset::GeneratorConfig,
CMakeGeneratorConfigHelper, false)
.Bind("binaryDir"_s, &UnexpandedPreset::BinaryDir, PresetStringHelper, .Bind("binaryDir"_s, &UnexpandedPreset::BinaryDir, PresetStringHelper,
false) false)
.Bind<std::string>("cmakeExecutable"_s, nullptr, 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.Generator, parent->second.Unexpanded.Generator);
InheritString(preset.Architecture, parent->second.Unexpanded.Architecture); InheritString(preset.Architecture, parent->second.Unexpanded.Architecture);
InheritString(preset.Toolset, parent->second.Unexpanded.Toolset); InheritString(preset.Toolset, parent->second.Unexpanded.Toolset);
if (!preset.GeneratorConfig) { if (!preset.ArchitectureStrategy) {
preset.GeneratorConfig = parent->second.Unexpanded.GeneratorConfig; preset.ArchitectureStrategy =
parent->second.Unexpanded.ArchitectureStrategy;
}
if (!preset.ToolsetStrategy) {
preset.ToolsetStrategy = parent->second.Unexpanded.ToolsetStrategy;
} }
InheritString(preset.BinaryDir, parent->second.Unexpanded.BinaryDir); InheritString(preset.BinaryDir, parent->second.Unexpanded.BinaryDir);
InheritOptionalBool(preset.WarnDev, parent->second.Unexpanded.WarnDev); InheritOptionalBool(preset.WarnDev, parent->second.Unexpanded.WarnDev);

View File

@@ -12,10 +12,10 @@
class cmCMakePresetsFile class cmCMakePresetsFile
{ {
public: public:
enum class CMakeGeneratorConfig enum class ArchToolsetStrategy
{ {
Default, Set,
Ignore, External,
}; };
class CacheVariable class CacheVariable
@@ -50,8 +50,9 @@ public:
std::string Description; std::string Description;
std::string Generator; std::string Generator;
std::string Architecture; std::string Architecture;
cm::optional<ArchToolsetStrategy> ArchitectureStrategy;
std::string Toolset; std::string Toolset;
cm::optional<CMakeGeneratorConfig> GeneratorConfig; cm::optional<ArchToolsetStrategy> ToolsetStrategy;
std::string BinaryDir; std::string BinaryDir;
std::map<std::string, cm::optional<CacheVariable>> CacheVariables; std::map<std::string, cm::optional<CacheVariable>> CacheVariables;

View File

@@ -1069,12 +1069,16 @@ void cmake::SetArgs(const std::vector<std::string>& args)
this->UnprocessedPresetVariables = expandedPreset->CacheVariables; this->UnprocessedPresetVariables = expandedPreset->CacheVariables;
this->UnprocessedPresetEnvironment = expandedPreset->Environment; this->UnprocessedPresetEnvironment = expandedPreset->Environment;
if (!expandedPreset->GeneratorConfig || if (!expandedPreset->ArchitectureStrategy ||
expandedPreset->GeneratorConfig == expandedPreset->ArchitectureStrategy ==
cmCMakePresetsFile::CMakeGeneratorConfig::Default) { cmCMakePresetsFile::ArchToolsetStrategy::Set) {
if (!this->GeneratorPlatformSet) { if (!this->GeneratorPlatformSet) {
this->SetGeneratorPlatform(expandedPreset->Architecture); this->SetGeneratorPlatform(expandedPreset->Architecture);
} }
}
if (!expandedPreset->ToolsetStrategy ||
expandedPreset->ToolsetStrategy ==
cmCMakePresetsFile::ArchToolsetStrategy::Set) {
if (!this->GeneratorToolsetSet) { if (!this->GeneratorToolsetSet) {
this->SetGeneratorToolset(expandedPreset->Toolset); this->SetGeneratorToolset(expandedPreset->Toolset);
} }

View File

@@ -24,8 +24,9 @@ void QCMakePresetComboBoxTest::changePresets()
/*description=*/"", /*description=*/"",
/*generator=*/"Ninja", /*generator=*/"Ninja",
/*architecture=*/"", /*architecture=*/"",
/*setArchitecture=*/true,
/*toolset=*/"", /*toolset=*/"",
/*setGenConfig=*/true, /*setToolset=*/true,
/*enabled=*/true, /*enabled=*/true,
}, },
}); });
@@ -48,8 +49,9 @@ void QCMakePresetComboBoxTest::changePresets()
/*description=*/"", /*description=*/"",
/*generator=*/"Ninja Multi-Config", /*generator=*/"Ninja Multi-Config",
/*architecture=*/"", /*architecture=*/"",
/*setArchitecture=*/true,
/*toolset=*/"", /*toolset=*/"",
/*setGenConfig=*/true, /*setToolset=*/true,
/*enabled=*/true, /*enabled=*/true,
}, },
}); });

View File

@@ -32,8 +32,9 @@ void QCMakePresetItemModelTest::initTestCase_data()
/*description=*/"", /*description=*/"",
/*generator=*/"", /*generator=*/"",
/*architecture=*/"", /*architecture=*/"",
/*setArchitecture=*/true,
/*toolset=*/"", /*toolset=*/"",
/*setGenConfig=*/true, /*setToolset=*/true,
/*enabled=*/true, /*enabled=*/true,
}, },
QCMakePreset{ QCMakePreset{
@@ -42,8 +43,9 @@ void QCMakePresetItemModelTest::initTestCase_data()
/*description=*/"", /*description=*/"",
/*generator=*/"", /*generator=*/"",
/*architecture=*/"", /*architecture=*/"",
/*setArchitecture=*/true,
/*toolset=*/"", /*toolset=*/"",
/*setGenConfig=*/true, /*setToolset=*/true,
/*enabled=*/true, /*enabled=*/true,
}, },
QCMakePreset{ QCMakePreset{
@@ -52,8 +54,9 @@ void QCMakePresetItemModelTest::initTestCase_data()
/*description=*/"Long Description", /*description=*/"Long Description",
/*generator=*/"", /*generator=*/"",
/*architecture=*/"", /*architecture=*/"",
/*setArchitecture=*/true,
/*toolset=*/"", /*toolset=*/"",
/*setGenConfig=*/true, /*setToolset=*/true,
/*enabled=*/true, /*enabled=*/true,
}, },
QCMakePreset{ QCMakePreset{
@@ -62,8 +65,9 @@ void QCMakePresetItemModelTest::initTestCase_data()
/*description=*/"", /*description=*/"",
/*generator=*/"", /*generator=*/"",
/*architecture=*/"", /*architecture=*/"",
/*setArchitecture=*/true,
/*toolset=*/"", /*toolset=*/"",
/*setGenConfig=*/true, /*setToolset=*/true,
/*enabled=*/false, /*enabled=*/false,
}, },
}; };

View File

@@ -16,8 +16,9 @@ QCMakePreset makePreset()
/*description=*/"description", /*description=*/"description",
/*generator=*/"generator", /*generator=*/"generator",
/*architecture=*/"architecture", /*architecture=*/"architecture",
/*setArchitecture=*/true,
/*toolset=*/"toolset", /*toolset=*/"toolset",
/*setGenConfig=*/true, /*setToolset=*/true,
/*enabled=*/true, /*enabled=*/true,
}; };
} }
@@ -69,12 +70,14 @@ void QCMakePresetTest::equality_data()
QTest::newRow("architecture") QTest::newRow("architecture")
<< makePreset(&QCMakePreset::architecture, "other-architecture") << false << makePreset(&QCMakePreset::architecture, "other-architecture") << false
<< true << false; << true << false;
QTest::newRow("setArchitecture")
<< makePreset(&QCMakePreset::setArchitecture, false) << false << false
<< true;
QTest::newRow("toolset") << makePreset(&QCMakePreset::toolset, QTest::newRow("toolset") << makePreset(&QCMakePreset::toolset,
"other-toolset") "other-toolset")
<< false << false << true; << false << false << true;
QTest::newRow("setGenConfig") QTest::newRow("setToolset")
<< makePreset(&QCMakePreset::setGenConfig, false) << false << false << makePreset(&QCMakePreset::setToolset, false) << false << false << true;
<< true;
QTest::newRow("enabled") << makePreset(&QCMakePreset::enabled, false) QTest::newRow("enabled") << makePreset(&QCMakePreset::enabled, false)
<< false << false << true; << false << false << true;
} }

View File

@@ -451,28 +451,38 @@
"binaryDir": "${sourceDir}/build" "binaryDir": "${sourceDir}/build"
}, },
{ {
"name": "CMakeGeneratorConfigNone", "name": "ArchToolsetStrategyNone",
"generator": "@RunCMake_GENERATOR@", "generator": "@RunCMake_GENERATOR@",
"architecture": "a", "architecture": "a",
"toolset": "a", "toolset": "a",
"binaryDir": "${sourceDir}/build" "binaryDir": "${sourceDir}/build"
}, },
{ {
"name": "CMakeGeneratorConfigBase", "name": "ArchToolsetStrategyBase",
"generator": "@RunCMake_GENERATOR@", "generator": "@RunCMake_GENERATOR@",
"architecture": "a", "architecture": {
"toolset": "a", "value": "a",
"cmakeGeneratorConfig": "ignore", "strategy": "external"
},
"toolset": {
"value": "a",
"strategy": "external"
},
"binaryDir": "${sourceDir}/build" "binaryDir": "${sourceDir}/build"
}, },
{ {
"name": "CMakeGeneratorConfigDefault", "name": "ArchToolsetStrategyDefault",
"inherits": "CMakeGeneratorConfigBase", "inherits": "ArchToolsetStrategyBase",
"cmakeGeneratorConfig": "default" "architecture": {
"strategy": "set"
},
"toolset": {
"strategy": "set"
}
}, },
{ {
"name": "CMakeGeneratorConfigIgnore", "name": "ArchToolsetStrategyIgnore",
"inherits": "CMakeGeneratorConfigBase" "inherits": "ArchToolsetStrategyBase"
} }
] ]
} }

View File

@@ -0,0 +1,2 @@
^CMake Error: Could not read presets from [^
]*/Tests/RunCMake/CMakePresets/InvalidArchitectureStrategy: Invalid preset$

View File

@@ -0,0 +1,13 @@
{
"version": 1,
"configurePresets": [
{
"name": "InvalidArchitectureStrategy",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build",
"architecture": {
"strategy": {}
}
}
]
}

View File

@@ -1,2 +0,0 @@
^CMake Error: Could not read presets from [^
]*/Tests/RunCMake/CMakePresets/InvalidCMakeGeneratorConfig: Invalid preset$

View File

@@ -0,0 +1,2 @@
^CMake Error: Could not read presets from [^
]*/Tests/RunCMake/CMakePresets/InvalidToolsetStrategy: Invalid preset$

View File

@@ -2,10 +2,12 @@
"version": 1, "version": 1,
"configurePresets": [ "configurePresets": [
{ {
"name": "InvalidCMakeGeneratorConfig", "name": "InvalidToolsetStrategy",
"generator": "@RunCMake_GENERATOR@", "generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build", "binaryDir": "${sourceDir}/build",
"cmakeGeneratorConfig": {} "toolset": {
"strategy": {}
}
} }
] ]
} }

View File

@@ -117,8 +117,10 @@ run_cmake_presets(InvalidInheritance)
run_cmake_presets(ErrorNoWarningDev) run_cmake_presets(ErrorNoWarningDev)
run_cmake_presets(ErrorNoWarningDeprecated) run_cmake_presets(ErrorNoWarningDeprecated)
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_presets(InvalidCMakeGeneratorConfig) run_cmake_presets(InvalidArchitectureStrategy)
run_cmake_presets(UnknownCMakeGeneratorConfig) run_cmake_presets(UnknownArchitectureStrategy)
run_cmake_presets(InvalidToolsetStrategy)
run_cmake_presets(UnknownToolsetStrategy)
run_cmake_presets(EmptyCacheKey) run_cmake_presets(EmptyCacheKey)
run_cmake_presets(EmptyEnvKey) run_cmake_presets(EmptyEnvKey)
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
@@ -196,9 +198,9 @@ if(RunCMake_GENERATOR MATCHES "^Visual Studio ")
run_cmake_presets(VisualStudioInheritanceMultiSecond) run_cmake_presets(VisualStudioInheritanceMultiSecond)
endif() endif()
else() else()
run_cmake_presets(CMakeGeneratorConfigNone) run_cmake_presets(ArchToolsetStrategyNone)
run_cmake_presets(CMakeGeneratorConfigDefault) run_cmake_presets(ArchToolsetStrategyDefault)
run_cmake_presets(CMakeGeneratorConfigIgnore) run_cmake_presets(ArchToolsetStrategyIgnore)
endif() endif()
# Test bad command line arguments # Test bad command line arguments

View File

@@ -0,0 +1,2 @@
^CMake Error: Could not read presets from [^
]*/Tests/RunCMake/CMakePresets/UnknownArchitectureStrategy: Invalid preset$

View File

@@ -0,0 +1,13 @@
{
"version": 1,
"configurePresets": [
{
"name": "UnknownArchitectureStrategy",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build",
"architecture": {
"strategy": "unknown"
}
}
]
}

View File

@@ -1,2 +0,0 @@
^CMake Error: Could not read presets from [^
]*/Tests/RunCMake/CMakePresets/UnknownCMakeGeneratorConfig: Invalid preset$

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,2 @@
^CMake Error: Could not read presets from [^
]*/Tests/RunCMake/CMakePresets/UnknownToolsetStrategy: Invalid preset$

View File

@@ -2,10 +2,12 @@
"version": 1, "version": 1,
"configurePresets": [ "configurePresets": [
{ {
"name": "UnknownCMakeGeneratorConfig", "name": "UnknownToolsetStrategy",
"generator": "@RunCMake_GENERATOR@", "generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build", "binaryDir": "${sourceDir}/build",
"cmakeGeneratorConfig": "unknown" "toolset": {
"strategy": "unknown"
}
} }
] ]
} }