summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-16 10:56:15 -0400
committerBrad King <brad.king@kitware.com>2021-06-16 13:24:32 -0400
commite4ca525d845e2b154ec7bc809071539618e2f7a2 (patch)
treea4c795c350bf826b00384f3529d3bdd785bf3446 /Source
parentaabc3ca47d51731e247300e4a6159f41e9dcb17c (diff)
downloadcmake-e4ca525d845e2b154ec7bc809071539618e2f7a2.tar.gz
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
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 1ebe40524b..fa51092e3a 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1361,7 +1361,10 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry,
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;
auto savedFlagIterator = loadedFlagJsonFiles.find(flagJsonPath);
@@ -1383,6 +1386,11 @@ cmIDEFlagTable const* cmLoadFlagTableJson(std::string const& flagJsonPath)
flagEntry.comment = cmLoadFlagTableString(flag, "comment");
flagEntry.value = cmLoadFlagTableString(flag, "value");
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);
}
cmIDEFlagTable endFlag{ "", "", "", "", 0 };
@@ -1458,7 +1466,8 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable(
}
}
- if (cmIDEFlagTable const* ret = cmLoadFlagTableJson(filename)) {
+ cm::optional<unsigned long long> vsver = this->GetVSInstanceVersion();
+ if (cmIDEFlagTable const* ret = cmLoadFlagTableJson(filename, vsver)) {
return ret;
}