qmake: Add support for C++23
Add the CONFIG value c++2b that represent the upcoming C++23 standard. Add QMAKE_CXXFLAGS_CXX2B and QMAKE_CXXFLAGS_GNUCXX2B. On MSVC, use /std:c++latest when c++2b is active. This fixes an issue with MSVC where c++latest implied the /std:c++20 compiler flag. Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-102202 Change-Id: Ie00ee5793c1a649195013c8c19efc8d59cf0acc9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
parent
6c760f8cef
commit
b5ed3cb7ba
@ -35,10 +35,12 @@ QMAKE_CXXFLAGS_CXX11 = -std=c++11
|
||||
QMAKE_CXXFLAGS_CXX14 = -std=c++1y
|
||||
QMAKE_CXXFLAGS_CXX1Z = -std=c++1z
|
||||
QMAKE_CXXFLAGS_CXX2A = -std=c++2a
|
||||
QMAKE_CXXFLAGS_CXX2B = -std=c++2b
|
||||
QMAKE_CXXFLAGS_GNUCXX11 = -std=gnu++11
|
||||
QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++1y
|
||||
QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z
|
||||
QMAKE_CXXFLAGS_GNUCXX2A = -std=gnu++2a
|
||||
QMAKE_CXXFLAGS_GNUCXX2B = -std=gnu++2b
|
||||
|
||||
QMAKE_LFLAGS_CXX11 =
|
||||
QMAKE_LFLAGS_CXX14 =
|
||||
|
@ -33,10 +33,12 @@ QMAKE_CXXFLAGS_CXX11 = -std=c++11
|
||||
QMAKE_CXXFLAGS_CXX14 = -std=c++1y
|
||||
QMAKE_CXXFLAGS_CXX1Z = -std=c++1z
|
||||
QMAKE_CXXFLAGS_CXX2A = -std=c++2a
|
||||
QMAKE_CXXFLAGS_CXX2B = -std=c++2b
|
||||
QMAKE_CXXFLAGS_GNUCXX11 = -std=gnu++11
|
||||
QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++1y
|
||||
QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z
|
||||
QMAKE_CXXFLAGS_GNUCXX2A = -std=gnu++2a
|
||||
QMAKE_CXXFLAGS_GNUCXX2B = -std=gnu++2b
|
||||
QMAKE_LFLAGS_CXX11 =
|
||||
QMAKE_LFLAGS_CXX14 =
|
||||
QMAKE_LFLAGS_CXX1Z =
|
||||
|
@ -120,6 +120,7 @@ greaterThan(QMAKE_MSC_VER, 1919) {
|
||||
MSVC_VER = 16.0
|
||||
MSVC_TOOLSET_VER = 142
|
||||
QMAKE_CXXFLAGS_CXX2A = -std:c++latest
|
||||
QMAKE_CXXFLAGS_CXX2B = -std:c++latest
|
||||
|
||||
QMAKE_CXXFLAGS += -Zc:externConstexpr
|
||||
}
|
||||
|
@ -123,17 +123,18 @@ breakpad {
|
||||
|
||||
c++17: CONFIG += c++1z
|
||||
c++20: CONFIG += c++2a
|
||||
c++latest: CONFIG *= c++2a c++1z c++14 c++11
|
||||
c++latest: CONFIG *= c++2b c++2a c++1z c++14 c++11
|
||||
|
||||
!c++1z:!c++2a {
|
||||
!c++1z:!c++2a:!c++2b {
|
||||
# Qt requires C++17
|
||||
QT_COMPILER_STDCXX_no_L = $$replace(QT_COMPILER_STDCXX, "L$", "")
|
||||
!greaterThan(QT_COMPILER_STDCXX_no_L, 201402): CONFIG += c++1z
|
||||
}
|
||||
c++1z|c++2a {
|
||||
c++1z|c++2a|c++2b {
|
||||
# Disable special compiler flags for host builds
|
||||
!host_build|!cross_compile {
|
||||
c++2a: cxxstd = CXX2A
|
||||
c++2b: cxxstd = CXX2B
|
||||
else:c++2a: cxxstd = CXX2A
|
||||
else: cxxstd = CXX1Z
|
||||
} else {
|
||||
# Fall back to c++17, because C++17 is required everywhere,
|
||||
|
@ -18,6 +18,7 @@ qtConfig(c++11): CONFIG += c++11 strict_c++
|
||||
qtConfig(c++14): CONFIG += c++14
|
||||
qtConfig(c++1z): CONFIG += c++1z
|
||||
qtConfig(c++2a): CONFIG += c++2a
|
||||
qtConfig(c++2b): CONFIG += c++2b
|
||||
qtConfig(c99): CONFIG += c99
|
||||
qtConfig(c11): CONFIG += c11
|
||||
qtConfig(separate_debug_info): CONFIG += separate_debug_info
|
||||
@ -162,4 +163,3 @@ warnings_are_errors:warning_clean {
|
||||
}
|
||||
unset(ver)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user