allow specifying a different CMAKE_OSX_SYSROOT
authorkoda
Sat, 04 Jan 2014 01:50:23 +0100
changeset 9940 fb1023bcd74f
parent 9939 462b644f415c
child 9941 d33d4727b39e
allow specifying a different CMAKE_OSX_SYSROOT
cmake_modules/platform.cmake
--- a/cmake_modules/platform.cmake	Fri Jan 03 20:15:43 2014 +0100
+++ b/cmake_modules/platform.cmake	Sat Jan 04 01:50:23 2014 +0100
@@ -73,7 +73,8 @@
 
     #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})
+    if(NOT CMAKE_OSX_SYSROOT AND
+       NOT ${minimum_macosx_version} VERSION_EQUAL ${current_macosx_version})
         find_program(xcrun xcrun)
         if(xcrun)
             execute_process(COMMAND ${xcrun} "--show-sdk-path"
@@ -83,13 +84,14 @@
                            "${minimum_macosx_version}"
                            CMAKE_OSX_SYSROOT
                            "${current_sdk_path}")
-
-            add_flag_append(CMAKE_Pascal_FLAGS "-XR${CMAKE_OSX_SYSROOT}")
-            add_flag_append(CMAKE_Pascal_FLAGS "-k-macosx_version_min -k${minimum_macosx_version}")
         else()
             message("*** xcrun not found! Build will work on ${current_macosx_version} only ***")
         endif()
     endif()
+    if(CMAKE_OSX_SYSROOT)
+        add_flag_append(CMAKE_Pascal_FLAGS "-XR${CMAKE_OSX_SYSROOT}")
+        add_flag_append(CMAKE_Pascal_FLAGS "-k-macosx_version_min -k${minimum_macosx_version}")
+    endif()
 
     #add user framework directory
     add_flag_append(CMAKE_Pascal_FLAGS "-Ff~/Library/Frameworks")