qt5base-lts/mkspecs/features/data/macros.cpp
Thiago Macieira a03390a8b0 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>
2017-03-31 21:08:32 +00:00

30 lines
824 B
C++

// Keep this file small. The pre-processed contents are eval'd by qmake.
QT_COMPILER_STDCXX = __cplusplus
#ifdef _MSC_VER
QMAKE_MSC_VER = _MSC_VER
QMAKE_MSC_FULL_VER = _MSC_FULL_VER
#endif
#ifdef __INTEL_COMPILER
QMAKE_ICC_VER = __INTEL_COMPILER
QMAKE_ICC_UPDATE_VER = __INTEL_COMPILER_UPDATE
#endif
#ifdef __APPLE_CC__
QMAKE_APPLE_CC = __APPLE_CC__
#endif
#ifdef __clang__
#ifdef __APPLE_CC__
QT_APPLE_CLANG_MAJOR_VERSION = __clang_major__
QT_APPLE_CLANG_MINOR_VERSION = __clang_minor__
QT_APPLE_CLANG_PATCH_VERSION = __clang_patchlevel__
#else
QT_CLANG_MAJOR_VERSION = __clang_major__
QT_CLANG_MINOR_VERSION = __clang_minor__
QT_CLANG_PATCH_VERSION = __clang_patchlevel__
#endif
#endif
#ifdef __GNUC__
QT_GCC_MAJOR_VERSION = __GNUC__
QT_GCC_MINOR_VERSION = __GNUC_MINOR__
QT_GCC_PATCH_VERSION = __GNUC_PATCHLEVEL__
#endif