summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/default_post.prf
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-03-04 09:33:35 -0800
committerThiago Macieira <thiago.macieira@intel.com>2017-03-31 21:08:32 +0000
commita03390a8b0318e30ae3b6dc9954093c137a20c32 (patch)
treedf22fd510d9d6b8889e7cc531beb20f6b75b61aa /mkspecs/features/default_post.prf
parent62013d77721820976102581b4cbd31404c109903 (diff)
Detect the (stated) C++ standard edition at build time
The configure-time detection (cxx11default) isn't enough if the compiler can be changed. This is especially necessary if Qt is compiled with a compiler that defaults to >= C++11 (e.g., GCC 6) and then the user selects a compiler another compiler (e.g., Clang) via -spec option. In that case, we'd miss adding the -std=c++11 or -std=gnu++11 option to the command-line, causing the compilation to fail. As a nice side-effect, even moc without moc_predefs.h will now get the __cplusplus setting. Task-number: QTBUG-58321 Change-Id: I74966ed02f674a7295f8fffd14a8be35da9640e1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'mkspecs/features/default_post.prf')
-rw-r--r--mkspecs/features/default_post.prf5
1 files changed, 5 insertions, 0 deletions
diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
index 60759b445e..359191c2d3 100644
--- a/mkspecs/features/default_post.prf
+++ b/mkspecs/features/default_post.prf
@@ -95,6 +95,11 @@ breakpad {
!isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$quote($$QMAKE_STRIP $$DEBUGFILENAME)
}
+!c++11:!c++14:!c++1z {
+ # Qt requires C++11 since 5.7, check if we need to force a compiler option
+ QT_COMPILER_STDCXX_no_L = $$replace(QT_COMPILER_STDCXX, "L$", "")
+ !greaterThan(QT_COMPILER_STDCXX_no_L, 199711): CONFIG += c++11
+}
c++11|c++14|c++1z {
# Disable special compiler flags for host builds
!host_build|!cross_compile {