summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-17 08:25:04 -0400
committerBrad King <brad.king@kitware.com>2021-06-17 08:25:04 -0400
commitb0f830ced6552b055bc73de470a4631aa3a14430 (patch)
treef935a2f38d6352730798e6c9fdaab1837ee9ca82 /Source
parent3fd65f5ca601d38c7b2ee8c99b148df31cea1acd (diff)
downloadcmake-b0f830ced6552b055bc73de470a4631aa3a14430.tar.gz
VS: Do not apply any '/external:*' flag table mapping on VS < 16.10
Since commit 887e9df0c7 (VS: Update v142 CL flag table for VS 16.10, 2021-06-04) we map several `/external:*` flags to their corresponding `.vcxproj` elements. These elements were added to `cl.xml` in VS 16.10, so filter them out in older VS versions. Add a field to the json flag table format to specify the minimum version of VS needed for a given mapping. Issue: #22308
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 6ce82f4ea6..fc2665b42b 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1361,8 +1361,6 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry,
namespace {
-std::string const vsVer16_10_0 = "16.10.31321.278";
-
cmIDEFlagTable const* cmLoadFlagTableJson(std::string const& flagJsonPath,
cm::optional<std::string> vsVer)
{
@@ -1380,18 +1378,22 @@ cmIDEFlagTable const* cmLoadFlagTableJson(std::string const& flagJsonPath,
if (reader.parse(stream, flags, false) && flags.isArray()) {
std::vector<cmIDEFlagTable> flagTable;
for (auto const& flag : flags) {
+ Json::Value const& vsminJson = flag["vsmin"];
+ if (vsminJson.isString()) {
+ std::string const& vsmin = vsminJson.asString();
+ if (!vsmin.empty()) {
+ if (!vsVer ||
+ cmSystemTools::VersionCompareGreater(vsmin, *vsVer)) {
+ continue;
+ }
+ }
+ }
cmIDEFlagTable flagEntry;
flagEntry.IDEName = cmLoadFlagTableString(flag, "name");
flagEntry.commandFlag = cmLoadFlagTableString(flag, "switch");
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 &&
- !cmSystemTools::VersionCompareGreaterEq(*vsVer, vsVer16_10_0) &&
- flagEntry.IDEName == "ExternalWarningLevel") {
- continue;
- }
flagTable.push_back(flagEntry);
}
cmIDEFlagTable endFlag{ "", "", "", "", 0 };