summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-17 10:45:51 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-06-17 10:45:57 (GMT)
commite05cf2d2de2768e97ae040006a469d85cb8404f0 (patch)
tree6395d52ad7731d0107930d0c132a19bf71887103 /Source
parent54860f1f6b04a30273a33ee1adbac7e204477aff (diff)
parentab3830401f5c2d2ef85c7d874af5c447a5ebe89d (diff)
downloadCMake-e05cf2d2de2768e97ae040006a469d85cb8404f0.zip
CMake-e05cf2d2de2768e97ae040006a469d85cb8404f0.tar.gz
CMake-e05cf2d2de2768e97ae040006a469d85cb8404f0.tar.bz2
Merge topic 'vs-map-external-warnings'
ab3830401f Merge branch 'backport-3.20-vs-map-external-warnings' e4ca525d84 VS: Do not apply '/external:W*' flag table mapping on VS < 16.10 aabc3ca47d cmGlobalVisualStudio10Generator: Adopt GetVSInstanceVersion method e66a7fe07b cmGlobalVisualStudio10Generator: Move static functions to anonymous namespace 947f0c8b81 VS: Do not apply '/external:W*' flag table mapping on VS < 16.10 e59a208b69 cmGlobalVisualStudio10Generator: Adopt GetVSInstanceVersion method d6d4af0ec3 cmGlobalVisualStudio10Generator: Move static functions to anonymous namespace Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6233
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx17
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h5
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx17
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h2
4 files changed, 31 insertions, 10 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 6c52ce0..fa51092 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1359,8 +1359,12 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry,
return value;
}
-static cmIDEFlagTable const* cmLoadFlagTableJson(
- std::string const& flagJsonPath)
+namespace {
+
+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);
@@ -1382,6 +1386,11 @@ static cmIDEFlagTable const* cmLoadFlagTableJson(
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 };
@@ -1394,6 +1403,7 @@ static cmIDEFlagTable const* cmLoadFlagTableJson(
}
return ret;
}
+}
cm::optional<std::string> cmGlobalVisualStudio10Generator::FindFlagTable(
cm::string_view toolsetName, cm::string_view table) const
@@ -1456,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;
}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 2596720..48fe465 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -128,6 +128,11 @@ public:
std::string Encoding() override;
const char* GetToolsVersion() const;
+ virtual cm::optional<unsigned long long> GetVSInstanceVersion() const
+ {
+ return {};
+ }
+
bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; }
bool FindMakeProgram(cmMakefile* mf) override;
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index c11ab1b..50dc30b 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -391,10 +391,15 @@ bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance(
return vsSetupAPIHelper.GetVSInstanceInfo(dir);
}
-bool cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion(
- unsigned long long& vsInstanceVersion) const
+cm::optional<unsigned long long>
+cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion() const
{
- return vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion);
+ cm::optional<unsigned long long> result;
+ unsigned long long vsInstanceVersion;
+ if (vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion)) {
+ result = vsInstanceVersion;
+ }
+ return result;
}
bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
@@ -407,9 +412,9 @@ bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
return false;
}
unsigned long long const vsInstanceVersion16_7_P2 = 4503631666610212;
- unsigned long long vsInstanceVersion;
- return (this->GetVSInstanceVersion(vsInstanceVersion) &&
- vsInstanceVersion > vsInstanceVersion16_7_P2);
+ cm::optional<unsigned long long> vsInstanceVersion =
+ this->GetVSInstanceVersion();
+ return (vsInstanceVersion && *vsInstanceVersion > vsInstanceVersion16_7_P2);
}
const char*
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h
index cee129e..105e495 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -28,7 +28,7 @@ public:
bool GetVSInstance(std::string& dir) const;
- bool GetVSInstanceVersion(unsigned long long& vsInstanceVersion) const;
+ cm::optional<unsigned long long> GetVSInstanceVersion() const override;
AuxToolset FindAuxToolset(std::string& version,
std::string& props) const override;