summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-08-06 16:49:12 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-08-07 08:01:10 +0000
commit43c2f366225af35d9d3a08c545253c754112424b (patch)
tree91f4bc72e1d842adcf9162f1f6eb5ca2238f075a
parentff10f8c3a58c2c57e221e294d5c4829c3fd05c15 (diff)
downloadqt-creator-43c2f366225af35d9d3a08c545253c754112424b.tar.gz
QbsProjectManager: Adapt to cpp.cxxLanguageVersion type change
Task-number: QTCREATORBUG-20909 Change-Id: Ic0c018b1a06e2d715d4ea6e301deeacc6aa7f480 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp
index c3d2993d5a..fe94dedb16 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.cpp
+++ b/src/plugins/qbsprojectmanager/qbsproject.cpp
@@ -827,13 +827,15 @@ static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags,
}
cFlags = cxxFlags = commonFlags;
- const QString cxxLanguageVersion = getCppProp("cxxLanguageVersion").toString();
- if (cxxLanguageVersion == "c++11")
- cxxFlags << "-std=c++0x";
- else if (cxxLanguageVersion == "c++14")
- cxxFlags << "-std=c++1y";
+ const auto cxxLanguageVersion = getCppProp("cxxLanguageVersion").toStringList();
+ if (cxxLanguageVersion.contains("c++17"))
+ cxxFlags << "-std=c++17";
+ else if (cxxLanguageVersion.contains("c++14"))
+ cxxFlags << "-std=c++14";
+ else if (cxxLanguageVersion.contains("c++11"))
+ cxxFlags << "-std=c++11";
else if (!cxxLanguageVersion.isEmpty())
- cxxFlags << ("-std=" + cxxLanguageVersion);
+ cxxFlags << ("-std=" + cxxLanguageVersion.first());
const QString cxxStandardLibrary = getCppProp("cxxStandardLibrary").toString();
if (!cxxStandardLibrary.isEmpty() && toolchain.contains("clang"))
cxxFlags << ("-stdlib=" + cxxStandardLibrary);
@@ -844,11 +846,13 @@ static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags,
if (enableRtti.isValid())
cxxFlags << QLatin1String(enableRtti.toBool() ? "-frtti" : "-fno-rtti");
- const QString cLanguageVersion = getCppProp("cLanguageVersion").toString();
- if (cLanguageVersion == "c11")
- cFlags << "-std=c1x";
+ const auto cLanguageVersion = getCppProp("cLanguageVersion").toStringList();
+ if (cLanguageVersion.contains("c11"))
+ cFlags << "-std=c11";
+ else if (cLanguageVersion.contains("c99"))
+ cFlags << "-std=c99";
else if (!cLanguageVersion.isEmpty())
- cFlags << ("-std=" + cLanguageVersion);
+ cFlags << ("-std=" + cLanguageVersion.first());
} else if (toolchain.contains("msvc")) {
if (enableExceptions.toBool()) {
const QString exceptionModel = getCppProp("exceptionHandlingModel").toString();
@@ -864,6 +868,8 @@ static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags,
cxxFlags << "/TP";
if (enableRtti.isValid())
cxxFlags << QLatin1String(enableRtti.toBool() ? "/GR" : "/GR-");
+ if (getCppProp("cxxLanguageVersion").toStringList().contains("c++17"))
+ cxxFlags << "/std:c++17";
}
}