parsing CMAKE_OSX_ARCHITECTURES cmake_pascal
authorkoda
Sun, 24 Mar 2013 10:48:37 +0100
branchcmake_pascal
changeset 8837 b9a15738711e
parent 8834 edceeafff671
child 8840 e1be48f36b82
parsing CMAKE_OSX_ARCHITECTURES
hedgewars/CMakeLists.txt
--- a/hedgewars/CMakeLists.txt	Fri Mar 22 10:43:43 2013 +0100
+++ b/hedgewars/CMakeLists.txt	Sun Mar 24 10:48:37 2013 +0100
@@ -104,12 +104,17 @@
 
 #DEPENDECIES AND EXECUTABLES SECTION
 if(APPLE)
-    string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}")
-    string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}")
-    string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}")
-
-    if(powerpc_build)
-        set(powerpc_build "powerpc")
+    if(CMAKE_OSX_ARCHITECTURES)
+        #parse this system variable and adjust only the powerpc syntax to be compatible with -P
+        string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}")
+        string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}")
+        string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}")
+        if(powerpc_build)
+            set(powerpc_build "powerpc")
+        endif()
+    elseif(CMAKE_SIZEOF_VOID_P MATCHES "8")
+        #if that variable is not set check if we are on x86_64 and if so force it, else use default
+        add_flag_append(CMAKE_Pascal_FLAGS -Px86_64)
     endif()
 
     #on OSX we need to provide the SDL_main() function when building as executable