summaryrefslogtreecommitdiff
path: root/cmake/base-config-ix.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/base-config-ix.cmake')
-rw-r--r--cmake/base-config-ix.cmake19
1 files changed, 13 insertions, 6 deletions
diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
index cef0e0d73..b85720ead 100644
--- a/cmake/base-config-ix.cmake
+++ b/cmake/base-config-ix.cmake
@@ -91,15 +91,22 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
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)