[PATCH] D65323: If XCode is not installed, `xcodebuild -version -sdk macosx Path` will give xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance In this case...
Alexander Richardson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 26 12:52:21 PDT 2019
arichardson updated this revision to Diff 211990.
arichardson added a comment.
Always use xcrun
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65323/new/
https://reviews.llvm.org/D65323
Files:
compiler-rt/cmake/base-config-ix.cmake
Index: compiler-rt/cmake/base-config-ix.cmake
===================================================================
--- compiler-rt/cmake/base-config-ix.cmake
+++ compiler-rt/cmake/base-config-ix.cmake
@@ -91,15 +91,22 @@
endif()
if(APPLE)
- # On Darwin if /usr/include doesn't exist, the user probably has Xcode but not
- # the command line tools. If this is the case, we need to find the OS X
- # sysroot to pass to clang.
- if(NOT EXISTS /usr/include)
- execute_process(COMMAND xcodebuild -version -sdk macosx Path
+ # On Darwin if /usr/include/c++ doesn't exist, the user probably has Xcode but
+ # not the command line tools (or is using macOS 10.14 or newer). If this is
+ # the case, we need to find the OS X sysroot to pass to clang.
+ if(NOT EXISTS /usr/include/c++)
+ execute_process(COMMAND xcrun -sdk macosx --show-sdk-path
OUTPUT_VARIABLE OSX_SYSROOT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}")
+ if (NOT OSX_SYSROOT OR NOT EXISTS ${OSX_SYSROOT})
+ message(WARNING "Detected OSX_SYSROOT ${OSX_SYSROOT} does not exist")
+ else()
+ message(STATUS "Found OSX_SYSROOT: ${OSX_SYSROOT}")
+ set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}")
+ endif()
+ else()
+ set(OSX_SYSROOT_FLAG "")
endif()
option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65323.211990.patch
Type: text/x-patch
Size: 1390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190726/897f897a/attachment.bin>
More information about the llvm-commits
mailing list