Add manually overriding of the darwin SDK version
authorValentin Churavy <v.churavy@gmail.com>
Tue, 31 Mar 2020 16:48:59 +0000 (12:48 -0400)
committerValentin Churavy <v.churavy@gmail.com>
Tue, 31 Mar 2020 16:54:56 +0000 (12:54 -0400)
Summary:
When doing cross-compilation from Linux to MacOS we don't have
access to have access to `xcodebuild` and therefore need a way
to set the SDK version from the outside.

Fixes https://reviews.llvm.org/D68292#1853594 for me.

Reviewers: delcypher, yln

Reviewed By: delcypher

Subscribers: #julialang, mgorny, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D77026

compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake

index 9f501a6..657d2c9 100644 (file)
@@ -44,8 +44,11 @@ function(find_darwin_sdk_dir var sdk_name)
 endfunction()
 
 function(find_darwin_sdk_version var sdk_name)
-  # We deliberately don't cache the result here because
-  # CMake's caching causes too many problems.
+  if (DARWIN_${sdk_name}_OVERRIDE_SDK_VERSION)
+    message(WARNING "Overriding ${sdk_name} SDK version to ${DARWIN_${sdk_name}_OVERRIDE_SDK_VERSION}")
+    set(${var} "${DARWIN_${sdk_name}_OVERRIDE_SDK_VERSION}" PARENT_SCOPE)
+    return()
+  endif()
   set(result_process 1)
   if(NOT DARWIN_PREFER_PUBLIC_SDK)
     # Let's first try the internal SDK, otherwise use the public SDK.