qmake: Introduce the variable MSVC_TOOLSET_VER
...which represents the version of the MSVC platform toolset. This variable is used to set the platform toolset version in .vcxproj files. Before, the platform toolset version was determined in qmake's C++ code. Now, it's set next to where MSVC_VER is set in common mkspecs .conf files. This will simplify supporting new Visual Studio versions in the future. Change-Id: If78c921f93c6378829746d617c7e7d312174257e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
1c880752eb
commit
3582116a60
@ -21,6 +21,7 @@ greaterThan(QMAKE_MSC_FULL_VER, 190023918):!intel_icl {
|
||||
greaterThan(QMAKE_MSC_VER, 1909) {
|
||||
# Visual Studio 2017 (15.0) / Visual C++ 19.10 and up
|
||||
MSVC_VER = 15.0
|
||||
MSVC_TOOLSET_VER = 141
|
||||
COMPAT_MKSPEC = win32-msvc2017
|
||||
}
|
||||
|
||||
@ -32,11 +33,13 @@ greaterThan(QMAKE_MSC_VER, 1910) {
|
||||
greaterThan(QMAKE_MSC_VER, 1919) {
|
||||
# Visual Studio 2019 (16.0) / Visual C++ 19.20 and up
|
||||
MSVC_VER = 16.0
|
||||
MSVC_TOOLSET_VER = 142
|
||||
}
|
||||
|
||||
greaterThan(QMAKE_MSC_VER, 1929) {
|
||||
# Visual Studio 2022 (17.0) / Visual C++ 19.30 and up
|
||||
MSVC_VER = 17.0
|
||||
MSVC_TOOLSET_VER = 143
|
||||
}
|
||||
|
||||
!isEmpty(COMPAT_MKSPEC):!$$COMPAT_MKSPEC: CONFIG += $$COMPAT_MKSPEC
|
||||
|
@ -15,6 +15,7 @@ COMPAT_MKSPEC = win32-msvc2005
|
||||
greaterThan(QMAKE_MSC_VER, 1499) {
|
||||
# Visual Studio 2008 (9.0) / Visual C++ 15.0 and up
|
||||
MSVC_VER = 9.0
|
||||
MSVC_TOOLSET_VER = 90
|
||||
COMPAT_MKSPEC = win32-msvc2008
|
||||
QMAKE_CFLAGS_MP = -MP
|
||||
QMAKE_CXXFLAGS_MP = $$QMAKE_CFLAGS_MP
|
||||
@ -23,6 +24,7 @@ greaterThan(QMAKE_MSC_VER, 1499) {
|
||||
greaterThan(QMAKE_MSC_VER, 1599) {
|
||||
# Visual Studio 2010 (10.0) / Visual C++ 16.0 and up
|
||||
MSVC_VER = 10.0
|
||||
MSVC_TOOLSET_VER = 100
|
||||
COMPAT_MKSPEC = win32-msvc2010
|
||||
MAKEFILE_GENERATOR = MSBUILD
|
||||
|
||||
@ -35,6 +37,7 @@ greaterThan(QMAKE_MSC_VER, 1599) {
|
||||
greaterThan(QMAKE_MSC_VER, 1699) {
|
||||
# Visual Studio 2012 (11.0) / Visual C++ 17.0 and up
|
||||
MSVC_VER = 11.0
|
||||
MSVC_TOOLSET_VER = 110
|
||||
COMPAT_MKSPEC = win32-msvc2012
|
||||
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = /wd4530 /wd4577
|
||||
QT_CONFIG += c++11
|
||||
@ -44,6 +47,7 @@ greaterThan(QMAKE_MSC_VER, 1699) {
|
||||
greaterThan(QMAKE_MSC_VER, 1799) {
|
||||
# Visual Studio 2013 (12.0) / Visual C++ 18.0 and up
|
||||
MSVC_VER = 12.0
|
||||
MSVC_TOOLSET_VER = 120
|
||||
COMPAT_MKSPEC = win32-msvc2013
|
||||
QMAKE_CFLAGS += -FS
|
||||
QMAKE_CXXFLAGS += -FS -Zc:rvalueCast -Zc:inline
|
||||
@ -63,6 +67,7 @@ greaterThan(QMAKE_MSC_VER, 1799) {
|
||||
greaterThan(QMAKE_MSC_VER, 1899) {
|
||||
# Visual Studio 2015 (14.0) / Visual C++ 19.0 and up
|
||||
MSVC_VER = 14.0
|
||||
MSVC_TOOLSET_VER = 140
|
||||
COMPAT_MKSPEC = win32-msvc2015
|
||||
QMAKE_CFLAGS += -Zc:strictStrings
|
||||
QMAKE_CFLAGS_WARN_ON += -w44456 -w44457 -w44458
|
||||
@ -77,6 +82,7 @@ greaterThan(QMAKE_MSC_VER, 1899) {
|
||||
greaterThan(QMAKE_MSC_VER, 1909) {
|
||||
# Visual Studio 2017 (15.0) / Visual C++ 19.10 and up
|
||||
MSVC_VER = 15.0
|
||||
MSVC_TOOLSET_VER = 141
|
||||
COMPAT_MKSPEC = win32-msvc2017
|
||||
QMAKE_CXXFLAGS += -permissive-
|
||||
|
||||
@ -112,6 +118,7 @@ greaterThan(QMAKE_MSC_VER, 1910) {
|
||||
greaterThan(QMAKE_MSC_VER, 1919) {
|
||||
# Visual Studio 2019 (16.0) / Visual C++ 19.20 and up
|
||||
MSVC_VER = 16.0
|
||||
MSVC_TOOLSET_VER = 142
|
||||
QMAKE_CXXFLAGS_CXX2A = -std:c++latest
|
||||
|
||||
QMAKE_CXXFLAGS += -Zc:externConstexpr
|
||||
@ -127,6 +134,7 @@ greaterThan(QMAKE_MSC_VER, 1927) {
|
||||
greaterThan(QMAKE_MSC_VER, 1929) {
|
||||
# Visual Studio 2022 (17.0) / Visual C++ 19.30 and up
|
||||
MSVC_VER = 17.0
|
||||
MSVC_TOOLSET_VER = 143
|
||||
}
|
||||
|
||||
!isEmpty(COMPAT_MKSPEC):!$$COMPAT_MKSPEC: CONFIG += $$COMPAT_MKSPEC
|
||||
|
@ -301,23 +301,7 @@ QString VcprojGenerator::retrievePlatformToolSet() const
|
||||
if (!envVar.isEmpty())
|
||||
return envVar;
|
||||
|
||||
switch (vcProject.Configuration.CompilerVersion)
|
||||
{
|
||||
case NET2012:
|
||||
return QStringLiteral("v110");
|
||||
case NET2013:
|
||||
return QStringLiteral("v120");
|
||||
case NET2015:
|
||||
return QStringLiteral("v140");
|
||||
case NET2017:
|
||||
return QStringLiteral("v141");
|
||||
case NET2019:
|
||||
return QStringLiteral("v142");
|
||||
case NET2022:
|
||||
return QStringLiteral("v143");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
return u"v"_qs + project->first("MSVC_TOOLSET_VER");
|
||||
}
|
||||
|
||||
bool VcprojGenerator::isStandardSuffix(const QString &suffix) const
|
||||
|
Loading…
Reference in New Issue
Block a user