OS X: If CMAKE_OSX_SYSROOT is already set do not compute default

The default computation logic is non-trivial.  Do not bother with it if
the value is already known.
This commit is contained in:
Brad King 2012-09-21 14:25:25 -04:00
parent 7995722e91
commit 2690738458
1 changed files with 6 additions and 4 deletions

View File

@ -99,10 +99,12 @@ endif()
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# CMAKE_OSX_SYSROOT # CMAKE_OSX_SYSROOT
# Environment variable set by the user overrides our default. if(CMAKE_OSX_SYSROOT)
# Use the same environment variable that Xcode uses. # Use the existing value without further computation to choose a default.
if(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}")
elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND
(NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}")) (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}"))
# Use the value of SDKROOT from the environment.
set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}") set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}")
else() else()
# Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory. # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory.