summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <[email protected]>2015-06-01 13:57:05 +0200
committerDennis Nienhüser <[email protected]>2015-06-01 15:36:40 +0200
commit7bf16819ace68cd790e21a457fe518533b1a0291 (patch)
tree7f582324d7bcc34e29ab45cc9ce15ea8b1cdcd6c
parentd4a59d903922a02c30a700d068590f6615895902 (diff)
Enable C++ 11 support
Please report a bug at https://bugs.kde.org/ if this breaks your build system / compiler for some reason. The plan for now is to use only those C++ 11 features that are supported by MSVC 10.0 and later. See also https://www.mail-archive.com/[email protected]/msg01736.html (cherry picked from commit 250137c8193f6db99ba918bd3a9e484fc59659ad)
-rw-r--r--CMakeLists.txt15
-rw-r--r--tests/ViewportParamsTest.cpp9
2 files changed, 20 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27396e6..3b724a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,21 @@ SET(CMAKE_COLOR_MAKEFILE ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+# Taken from KDECompilerSettings.cmake:
+# Pick sensible versions of the C and C++ standards.
+# Note that MSVC does not have equivalent flags; the features are either
+# supported or they are not.
+if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+ # We use the C89 standard because that is what is common to all our
+ # compilers (in particular, MSVC 2010 does not support C99)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=iso9899:1990")
+endif()
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+endif()
+
####################################################
# Where to look first for cmake modules,
# before ${CMAKE_ROOT}/Modules/ is checked
diff --git a/tests/ViewportParamsTest.cpp b/tests/ViewportParamsTest.cpp
index 38b7928..d81e324 100644
--- a/tests/ViewportParamsTest.cpp
+++ b/tests/ViewportParamsTest.cpp
@@ -18,6 +18,11 @@
#include "GeoDataLineString.h"
#include "GeoDataLinearRing.h"
+Q_DECLARE_METATYPE( Marble::GeoDataLinearRing )
+Q_DECLARE_METATYPE( Marble::Projection )
+Q_DECLARE_METATYPE( Marble::TessellationFlag )
+Q_DECLARE_METATYPE( Marble::TessellationFlags )
+
namespace Marble
{
@@ -535,10 +540,6 @@ void ViewportParamsTest::setFocusPoint()
}
-Q_DECLARE_METATYPE( Marble::GeoDataLinearRing )
-Q_DECLARE_METATYPE( Marble::Projection )
-Q_DECLARE_METATYPE( Marble::TessellationFlag )
-Q_DECLARE_METATYPE( Marble::TessellationFlags )
QTEST_MAIN( Marble::ViewportParamsTest )
#include "ViewportParamsTest.moc"