Skip to content

Commit

Permalink
Teach qmake MSVC's compiler options /std:c++[14|17|latest]
Browse files Browse the repository at this point in the history
This fixes the "could not parse compiler option" warning when
generating VS project files.

Fixes: QTBUG-75275
Change-Id: Idd98ae5fdb8ebf5a4e311cbb6cd3ed1daba74ca4
Reviewed-by: Kai Koehne <[email protected]>
  • Loading branch information
jobor committed Apr 23, 2019
1 parent f36a306 commit de854aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qmake/generators/win32/msbuild_objectmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions qmake/generators/win32/msvc_objectmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions qmake/generators/win32/msvc_objectmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ class VCCLCompilerTool : public VCToolBase
triState ImproveFloatingPointConsistency;
inlineExpansionOption InlineFunctionExpansion;
triState KeepComments;
QString LanguageStandard;
triState MinimalRebuild;
QString ObjectFile;
triState OmitDefaultLibName;
Expand Down

0 comments on commit de854aa

Please sign in to comment.