diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-11-15 18:14:41 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-11-15 18:14:41 (GMT) |
commit | 90e6f983de18868e137537e01ee0079514b9368e (patch) | |
tree | e8ea7eab90e4ec04e9310bb9cd647c459b409c17 /Modules | |
parent | 9abbad8171e3b4dc376f184ca0400eff3479775d (diff) | |
download | CMake-90e6f983de18868e137537e01ee0079514b9368e.zip CMake-90e6f983de18868e137537e01ee0079514b9368e.tar.gz CMake-90e6f983de18868e137537e01ee0079514b9368e.tar.bz2 |
ENH: add support for env var and better default for CMAKE_OSX_SYSROOT
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Platform/Darwin.cmake | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index f9d3515..7ba6c56 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -49,13 +49,19 @@ SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") 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 @@ IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) # 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]$") |