[PATCH] D65323: [compiler-rt] Fix running tests on macOS when XCode is not installed

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 27 05:32:39 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL367170: [compiler-rt] Fix running tests on macOS when XCode is not installed (authored by arichardson, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D65323?vs=211990&id=212050#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65323/new/

https://reviews.llvm.org/D65323

Files:
  compiler-rt/trunk/cmake/base-config-ix.cmake


Index: compiler-rt/trunk/cmake/base-config-ix.cmake
===================================================================
--- compiler-rt/trunk/cmake/base-config-ix.cmake
+++ compiler-rt/trunk/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.212050.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190727/ecdde3e6/attachment.bin>


More information about the llvm-commits mailing list