MacOS.sdk: return newest SDK if requested not found

`MacOS.sdk` and `.sdk_path` will now return the newest installed SDK
instead of nil if called on a system that doesn’t have an SDK for the
currently-installed OS. For example, Xcode 7 on OS X 10.10 does not
include the 10.10 SDK, only the 10.11 SDK; software can be built by
specifying both SDKROOT and MACOSX_DEPLOYMENT_TARGET.
This commit is contained in:
Misty De Meo 2015-12-04 14:40:24 -08:00
parent 3a1d7e7259
commit 48bdd4811e

View File

@ -89,6 +89,9 @@ module OS
begin
@locator.sdk_for v
rescue SDKLocator::NoSDKError
sdk = @locator.latest_sdk
# don't return an SDK that's older than the OS version
sdk unless sdk.nil? || sdk.version < version
end
end