Fix compiler-rt build on macOS without XCode

Summary:
Starting with 8a5bfbe6db (D68292) this file
unconditionally uses xcodebuild to get the SDK version. On my system this
always fails with
`xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance`

Reviewers: delcypher, yln

Reviewed By: delcypher, yln

Subscribers: dberris, mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D69610
This commit is contained in:
Alex Richardson 2019-10-31 21:17:23 +00:00
parent 54a873b158
commit 52beec76de
1 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ function(find_darwin_sdk_version var sdk_name)
if(NOT DARWIN_PREFER_PUBLIC_SDK) if(NOT DARWIN_PREFER_PUBLIC_SDK)
# Let's first try the internal SDK, otherwise use the public SDK. # Let's first try the internal SDK, otherwise use the public SDK.
execute_process( execute_process(
COMMAND xcodebuild -version -sdk ${sdk_name}.internal SDKVersion COMMAND xcrun --sdk ${sdk_name}.internal --show-sdk-version
RESULT_VARIABLE result_process RESULT_VARIABLE result_process
OUTPUT_VARIABLE var_internal OUTPUT_VARIABLE var_internal
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
@ -58,7 +58,7 @@ function(find_darwin_sdk_version var sdk_name)
endif() endif()
if((NOT ${result_process} EQUAL 0) OR "" STREQUAL "${var_internal}") if((NOT ${result_process} EQUAL 0) OR "" STREQUAL "${var_internal}")
execute_process( execute_process(
COMMAND xcodebuild -version -sdk ${sdk_name} SDKVersion COMMAND xcrun --sdk ${sdk_name} --show-sdk-version
RESULT_VARIABLE result_process RESULT_VARIABLE result_process
OUTPUT_VARIABLE var_internal OUTPUT_VARIABLE var_internal
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE