[cmake-commits] hoffman committed Darwin.cmake 1.40 1.41

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Nov 15 13:14:43 EST 2007


Update of /cvsroot/CMake/CMake/Modules/Platform
In directory public:/mounts/ram/cvs-serv11223

Modified Files:
	Darwin.cmake 
Log Message:
ENH: add support for env var and better default for CMAKE_OSX_SYSROOT


Index: Darwin.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/Platform/Darwin.cmake,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- Darwin.cmake	8 Nov 2007 19:31:56 -0000	1.40
+++ Darwin.cmake	15 Nov 2007 18:14:41 -0000	1.41
@@ -49,13 +49,19 @@
 IF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
   SET(CMAKE_INSTALL_NAME_TOOL install_name_tool)
 ENDIF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
-
-
+# find installed SDKs
+FILE(GLOB _CMAKE_OSX_SDKS "/Developer/SDKs/*")
 # setup for universal binaries if sysroot exists
-IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
-  # set the sysroot to be used if CMAKE_OSX_ARCHITECTURES
-  # has more than one value
-  SET(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk CACHE STRING
+IF(_CMAKE_OSX_SDKS) 
+  # find the most recent sdk for the default
+  LIST(SORT _CMAKE_OSX_SDKS)
+  LIST(REVERSE _CMAKE_OSX_SDKS)
+  LIST(GET _CMAKE_OSX_SDKS 0 _CMAKE_OSX_SDKS)
+  # use the environment variable CMAKE_OSX_SYSROOT if it is set
+  IF(NOT "$ENV{CMAKE_OSX_SYSROOT}" STREQUAL "") 
+    SET(_CMAKE_OSX_SDKS "$ENV{CMAKE_OSX_SYSROOT}")
+  ENDIF(NOT "$ENV{CMAKE_OSX_SYSROOT}" STREQUAL "") 
+  SET(CMAKE_OSX_SYSROOT ${_CMAKE_OSX_SDKS} CACHE STRING
     "isysroot used for universal binary support")
   # set _CMAKE_OSX_MACHINE to umame -m
   EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE)
@@ -74,7 +80,7 @@
   # now put _CMAKE_OSX_MACHINE into the cache
   SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE}
     CACHE STRING "Build architectures for OSX")
-ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
+ENDIF(_CMAKE_OSX_SDKS)
 
 
 IF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")



More information about the Cmake-commits mailing list