mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 03:48:02 +08:00
VS: Do not apply '/external:W*' flag table mapping on VS < 16.10
Since commit 9054cd05e6
(VS: Add flag table entries for '/external:W*'
flags in VS 16.10, 2021-05-28, v3.20.4~10^2) we map flags to the
`ExternalWarningLevel` element. VS 16.9 does not support that element,
but its `cl` compiler does support the `/external:W*` flags. Filter out
the flag table entry on older VS versions.
Fixes: #22308
This commit is contained in:
@@ -1315,7 +1315,10 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry,
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
cmIDEFlagTable const* cmLoadFlagTableJson(std::string const& flagJsonPath)
|
unsigned long long const vsVer16_10_0 = 4503644629696790;
|
||||||
|
|
||||||
|
cmIDEFlagTable const* cmLoadFlagTableJson(
|
||||||
|
std::string const& flagJsonPath, cm::optional<unsigned long long> vsver)
|
||||||
{
|
{
|
||||||
cmIDEFlagTable* ret = nullptr;
|
cmIDEFlagTable* ret = nullptr;
|
||||||
auto savedFlagIterator = loadedFlagJsonFiles.find(flagJsonPath);
|
auto savedFlagIterator = loadedFlagJsonFiles.find(flagJsonPath);
|
||||||
@@ -1337,6 +1340,11 @@ cmIDEFlagTable const* cmLoadFlagTableJson(std::string const& flagJsonPath)
|
|||||||
flagEntry.comment = cmLoadFlagTableString(flag, "comment");
|
flagEntry.comment = cmLoadFlagTableString(flag, "comment");
|
||||||
flagEntry.value = cmLoadFlagTableString(flag, "value");
|
flagEntry.value = cmLoadFlagTableString(flag, "value");
|
||||||
flagEntry.special = cmLoadFlagTableSpecial(flag, "flags");
|
flagEntry.special = cmLoadFlagTableSpecial(flag, "flags");
|
||||||
|
// FIXME: Port this version check to a Json field.
|
||||||
|
if (vsver && *vsver < vsVer16_10_0 &&
|
||||||
|
flagEntry.IDEName == "ExternalWarningLevel") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
flagTable.push_back(flagEntry);
|
flagTable.push_back(flagEntry);
|
||||||
}
|
}
|
||||||
cmIDEFlagTable endFlag{ "", "", "", "", 0 };
|
cmIDEFlagTable endFlag{ "", "", "", "", 0 };
|
||||||
@@ -1364,17 +1372,19 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable(
|
|||||||
{
|
{
|
||||||
cmIDEFlagTable const* ret = nullptr;
|
cmIDEFlagTable const* ret = nullptr;
|
||||||
|
|
||||||
|
cm::optional<unsigned long long> vsver = this->GetVSInstanceVersion();
|
||||||
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
if (!optionsName.empty()) {
|
if (!optionsName.empty()) {
|
||||||
filename = cmGetFlagTableName(optionsName, table);
|
filename = cmGetFlagTableName(optionsName, table);
|
||||||
ret = cmLoadFlagTableJson(filename);
|
ret = cmLoadFlagTableJson(filename, vsver);
|
||||||
} else {
|
} else {
|
||||||
filename = cmGetFlagTableName(toolsetName, table);
|
filename = cmGetFlagTableName(toolsetName, table);
|
||||||
if (cmSystemTools::FileExists(filename)) {
|
if (cmSystemTools::FileExists(filename)) {
|
||||||
ret = cmLoadFlagTableJson(filename);
|
ret = cmLoadFlagTableJson(filename, vsver);
|
||||||
} else {
|
} else {
|
||||||
filename = cmGetFlagTableName(defaultName, table);
|
filename = cmGetFlagTableName(defaultName, table);
|
||||||
ret = cmLoadFlagTableJson(filename);
|
ret = cmLoadFlagTableJson(filename, vsver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user