cmake_modules/platform.cmake
changeset 9271 118cc5c1f677
parent 9268 8a9075ed0aab
child 9297 3f16f5e43814
--- a/cmake_modules/platform.cmake	Thu Jun 27 12:02:40 2013 +0200
+++ b/cmake_modules/platform.cmake	Thu Jun 27 12:09:24 2013 +0200
@@ -52,6 +52,29 @@
         endif()
     endif()
 
+    #parse this system variable and adjust only the powerpc syntax to be compatible with -P
+    if(CMAKE_OSX_ARCHITECTURES)
+        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(x86_64_build)
+            add_flag_prepend(CMAKE_Pascal_FLAGS -Px86_64)
+        elseif(i386_build)
+            add_flag_prepend(CMAKE_Pascal_FLAGS -Pi386)
+        elseif(powerpc_build)
+            add_flag_prepend(CMAKE_Pascal_FLAGS -Ppowerpc)
+        else()
+            message(FATAL_ERROR "Unknown architecture present in CMAKE_OSX_ARCHITECTURES (${CMAKE_OSX_ARCHITECTURES})")
+        endif()
+        list(LENGTH CMAKE_OSX_ARCHITECTURES num_of_archs)
+        if(num_of_archs GREATER 1)
+            message(${WARNING} "Only one architecture in CMAKE_OSX_ARCHITECTURES is currently supported, picking the first one")
+        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_prepend(CMAKE_Pascal_FLAGS -Px86_64)
+    endif()
+
     #CMAKE_OSX_SYSROOT is set at the system version we are supposed to build on
     #we need to provide the correct one when host and target differ
     if(NOT ${minimum_macosx_version} VERSION_EQUAL ${current_macosx_version})