Fix compiling on MacOS X by requiring c++11 standard. Building now requires MacOS X 10.8+ and CMake 3.9+ 0.9.25
authorraptor <buckyballreaction@gmail.com>
Tue, 13 Aug 2019 13:10:12 -0600
branch0.9.25
changeset 15331 93b43cf0b792
parent 15330 0590e7f7c8e0
child 15332 9a545985360b
Fix compiling on MacOS X by requiring c++11 standard. Building now requires MacOS X 10.8+ and CMake 3.9+
cmake_modules/platform.cmake
share/CMakeLists.txt
--- a/cmake_modules/platform.cmake	Tue Aug 13 12:29:26 2019 -0600
+++ b/cmake_modules/platform.cmake	Tue Aug 13 13:10:12 2019 -0600
@@ -1,9 +1,12 @@
 
 if(APPLE)
-    if(${CMAKE_VERSION} VERSION_GREATER "2.8.10.2" AND
-       ${CMAKE_VERSION} VERSION_LESS "2.8.12.1")
-        message(FATAL_ERROR "This version of CMake is known *not* to work, please update or use a lower version")
-    endif()
+    #minimum for macOS.  sorry!
+    cmake_minimum_required(VERSION 3.9.0)
+
+    #set c++11 standard for QT requirements
+    set(CMAKE_CXX_STANDARD 11)
+    set(CMAKE_CXX_STANDARD_REQUIRED ON)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
 
     set(CMAKE_FIND_FRAMEWORK "FIRST")
 
@@ -31,21 +34,10 @@
         set(minimum_macosx_version ${current_macosx_version})
     endif()
 
-    #10.3 systems don't have enough processing power anyway
-    #10.4 does not have @rpath support (which SDL uses)
-    if(minimum_macosx_version VERSION_LESS "10.5")
-        message(FATAL_ERROR "Hedgewars is not supported on your version of Mac OS X")
-    endif()
-
-    if(NOT CMAKE_OSX_ARCHITECTURES)
-        if(current_macosx_version VERSION_LESS "10.6")
-            #SDL is only 32 bit on older OS version
-            if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "powerpc*")
-                set(CMAKE_OSX_ARCHITECTURES "ppc7400")
-            else()
-                set(CMAKE_OSX_ARCHITECTURES "i386")
-            endif()
-        endif()
+    #minimum OSX version is 10.8.  Earlier versions cannot compile some dependencies anymore
+    #(like ffmpeg/libav)
+    if(minimum_macosx_version VERSION_LESS "10.8")
+        message(FATAL_ERROR "Hedgewars is unsupported on your platform and requires Mac OS X 10.8+")
     endif()
 
     #parse this system variable and adjust only the powerpc syntax to be compatible with -P
@@ -97,12 +89,6 @@
     #add user framework directory
     add_flag_append(CMAKE_Pascal_FLAGS "-Ff~/Library/Frameworks")
 
-    #workaround older cmake versions
-    if(${CMAKE_VERSION} VERSION_LESS "2.8.12")
-        add_flag_append(CMAKE_C_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}")
-        add_flag_append(CMAKE_CXX_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}")
-        add_flag_append(CMAKE_Pascal_LINK_FLAGS "-k-rpath -k${CMAKE_INSTALL_RPATH}")
-    endif()
 endif(APPLE)
 
 if(MINGW)
--- a/share/CMakeLists.txt	Tue Aug 13 12:29:26 2019 -0600
+++ b/share/CMakeLists.txt	Tue Aug 13 13:10:12 2019 -0600
@@ -7,11 +7,6 @@
     #CFBundleVersion is HEDGEWARS_REVISION
     #CFBundleShortVersionString is HEDGEWARS_VERSION
 
-    #libav/ffmpeg always brings in VideoDecoderAcceleration, avaible only from 10.6.3
-    if(LIBAV_FOUND AND ${minimum_macosx_version} VERSION_EQUAL "10.6")
-        set(minimum_macosx_version "10.6.3")
-    endif()
-
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
                    ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
     #path here should be Hedgewars.app/Contents/MacOS