diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-08-22 17:12:47 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-08-23 15:09:56 +0000 |
commit | 29ff75ef89d93934bdbc38e24398e766e6597508 (patch) | |
tree | 1db4075256f98eeb9536b3750c15ddc0e80eb82a /share | |
parent | 1b046f750bb3bd26d97073c648662c672eb0fc95 (diff) |
Support MSVC's /std option
We failed to notice that it was introduced with update 3 of VS 2013.
[ChangeLog] The cpp.cxxLanguageVersion property now gets mapped to
MSVC's /std option, if applicable.
Change-Id: I00d45aecefb2ad27f2b5891d62d591179f2dbeec
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/modules/cpp/msvc.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js index a79523ca9..6ca6dad00 100644 --- a/share/qbs/modules/cpp/msvc.js +++ b/share/qbs/modules/cpp/msvc.js @@ -43,6 +43,25 @@ function compilerVersionDefine(cpp) { return result; } +function addLanguageVersionFlag(input, args) { + var cxxVersion = input.cpp.cxxLanguageVersion; + if (!cxxVersion) + return; + + // Visual C++ 2013, Update 3 + var hasStdOption = Utilities.versionCompare(input.cpp.compilerVersion, "18.00.30723") >= 0; + if (!hasStdOption) + return; + + var flag; + if (cxxVersion === "c++14") + flag = "/std:c++14"; + else if (cxxVersion !== "c++11" && cxxVersion !== "c++98") + flag = "/std:c++latest"; + if (flag) + args.push(flag); +} + function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var i; var debugInformation = input.cpp.debugInformation; @@ -148,10 +167,12 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli args.push("/FI" + FileInfo.toWindowsSeparators(prefixHeaders[i])); // Language - if (tag === "cpp") + if (tag === "cpp") { args.push("/TP"); - else if (tag === "c") + addLanguageVersionFlag(input, args); + } else if (tag === "c") { args.push("/TC"); + } // Whether we're compiling a precompiled header or normal source file var pchOutput = outputs[tag + "_pch"] ? outputs[tag + "_pch"][0] : undefined; |