← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~hjd/widelands/nullptr into lp:widelands

 

Hans Joachim Desserud has proposed merging lp:~hjd/widelands/nullptr into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1203492 in widelands: "Fail to build in Ubuntu 10.04 LTS"
  https://bugs.launchpad.net/widelands/+bug/1203492

For more details, see:
https://code.launchpad.net/~hjd/widelands/nullptr/+merge/176063

I tested with adding -Dnullptr=NULL to the compilerflags which made it build again on 10.04.

The following change in cmake should add it for gcc versions older than 4.6. I'll be the first to admit this patch, isn't pretty but none of the alternatives seemed a lot better either.

Not done extensive testing with this, but seems to be set only when it should.
-- 
https://code.launchpad.net/~hjd/widelands/nullptr/+merge/176063
Your team Widelands Developers is requested to review the proposed merge of lp:~hjd/widelands/nullptr into lp:widelands.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2013-07-21 14:23:14 +0000
+++ CMakeLists.txt	2013-07-21 15:26:27 +0000
@@ -173,10 +173,18 @@
 if(CMAKE_COMPILER_IS_GNUCXX)
   EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
   if (GCC_VERSION VERSION_LESS 4.7)
-    if (NOT WIN32)
-      set (PARAMETER_COMPILERFLAG_CXXSTD "-std=c++0x")
+    if (GCC_VERSION VERSION_LESS 4.6)
+      if (NOT WIN32)
+        set (PARAMETER_COMPILERFLAG_CXXSTD "-std=c++0x -Dnullptr=NULL")
+      else()
+        set (PARAMETER_COMPILERFLAG_CXXSTD "-std=gnu++0x -Dnullptr=NULL")
+      endif()
     else()
-      set (PARAMETER_COMPILERFLAG_CXXSTD "-std=gnu++0x")
+      if (NOT WIN32)
+        set (PARAMETER_COMPILERFLAG_CXXSTD "-std=c++0x")
+      else()
+        set (PARAMETER_COMPILERFLAG_CXXSTD "-std=gnu++0x")
+      endif()
     endif()
   endif()
 endif()