Teach qmake MSVC's compiler options /std:c++[14|17|latest]

This fixes the "could not parse compiler option" warning when
generating VS project files.

Fixes: QTBUG-75275
Change-Id: Idd98ae5fdb8ebf5a4e311cbb6cd3ed1daba74ca4
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Joerg Bornemann 2019-04-23 09:54:46 +02:00
parent f36a306563
commit de854aa37f
3 changed files with 11 additions and 0 deletions

View File

@ -143,6 +143,7 @@ const char _InterfaceIdentifierFileName[] = "InterfaceIdentifierFileName";
const char _IntermediateDirectory[] = "IntermediateDirectory";
const char _KeyContainer[] = "KeyContainer";
const char _KeyFile[] = "KeyFile";
const char _LanguageStandard[] = "LanguageStandard";
const char _LargeAddressAware[] = "LargeAddressAware";
const char _LinkDLL[] = "LinkDLL";
const char _LinkErrorReporting[] = "LinkErrorReporting";
@ -1492,6 +1493,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool)
<< attrTagT(_IntrinsicFunctions, tool.EnableIntrinsicFunctions)
<< attrTagT(_MinimalRebuild, tool.MinimalRebuild)
<< attrTagT(_MultiProcessorCompilation, tool.MultiProcessorCompilation)
<< attrTagS(_LanguageStandard, tool.LanguageStandard)
<< attrTagS(_ObjectFileName, tool.ObjectFile)
<< attrTagT(_OmitDefaultLibName, tool.OmitDefaultLibName)
<< attrTagT(_OmitFramePointers, tool.OmitFramePointers)

View File

@ -1146,6 +1146,14 @@ bool VCCLCompilerTool::parseOption(const char* option)
ShowIncludes = _True;
break;
}
if (strlen(option) > 8 && second == 't' && third == 'd') {
const QString version = option + 8;
static const QStringList knownVersions = { "14", "17", "latest" };
if (knownVersions.contains(version)) {
LanguageStandard = "stdcpp" + version;
break;
}
}
found = false; break;
case 'u':
if (!second)

View File

@ -526,6 +526,7 @@ public:
triState ImproveFloatingPointConsistency;
inlineExpansionOption InlineFunctionExpansion;
triState KeepComments;
QString LanguageStandard;
triState MinimalRebuild;
QString ObjectFile;
triState OmitDefaultLibName;