Fix building of the C++11 config.test on Windows with ICL

The Intel compiler does support C++11 options on the command-line.
configure.exe will correctly try to run it, but the test would fail for
incorrect reasons.

First, we need to pass the option -Qstd=c++11 to enable it.

Second, on Windows, the GCC experimental define isn't defined, nor is
__cplusplus updated yet. So we have to rely on the Intel-specific macro.

Third, we need CONFIG += console so that the application succeeds in
linking against a main() function, as opposed to a WinMain one.

Change-Id: I8f3252189df4f8854a9d9aa2cd919c288d2df420
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Thiago Macieira 2014-06-23 18:43:06 -07:00
parent b3e6d18687
commit 032f0f543e
3 changed files with 4 additions and 3 deletions

View File

@ -39,10 +39,10 @@
** **
****************************************************************************/ ****************************************************************************/
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__INTEL_CXX11_MODE__)
// Compiler claims to support C++11, trust it // Compiler claims to support C++11, trust it
#else #else
# error "__cplusplus must be >= 201103L, or __GXX_EXPERIMENTAL_CXX0X__ must be defined" # error "__cplusplus must be >= 201103L, or one of __GXX_EXPERIMENTAL_CXX0X__ or __INTEL_CXX11_MODE__ must be defined"
#endif #endif
#include <utility> #include <utility>

View File

@ -1,3 +1,3 @@
SOURCES = c++11.cpp SOURCES = c++11.cpp
CONFIG += c++11 CONFIG += c++11 console
CONFIG -= qt CONFIG -= qt

View File

@ -39,6 +39,7 @@ QMAKE_CXXFLAGS_RTTI_ON = -GR
QMAKE_CXXFLAGS_RTTI_OFF = QMAKE_CXXFLAGS_RTTI_OFF =
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -GX QMAKE_CXXFLAGS_EXCEPTIONS_ON = -GX
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
QMAKE_CXXFLAGS_CXX11 = -Qstd=c++11
QMAKE_INCDIR = QMAKE_INCDIR =