[PATCH] D34736: [cmake] Cache results of find_darwin_sdk_dir

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 10:32:08 PDT 2017


kubamracek updated this revision to Diff 105472.
kubamracek retitled this revision from "[cmake] Cache results of find_darwin_sdk_dir and add an option to prefer public SDK" to "[cmake] Cache results of find_darwin_sdk_dir".
kubamracek edited the summary of this revision.
kubamracek added a reviewer: george.karpenkov.

https://reviews.llvm.org/D34736

Files:
  cmake/Modules/CompilerRTDarwinUtils.cmake


Index: cmake/Modules/CompilerRTDarwinUtils.cmake
===================================================================
--- cmake/Modules/CompilerRTDarwinUtils.cmake
+++ cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -1,9 +1,15 @@
 include(CMakeParseArguments)
 
+set(DARWIN_${sdk_name}_CACHED_SYSROOT "" CACHE STRING "Darwin SDK path for SDK ${sdk_name}.")
+
 # On OS X SDKs can be installed anywhere on the base system and xcode-select can
 # set the default Xcode to use. This function finds the SDKs that are present in
 # the current Xcode.
-function(find_darwin_sdk_dir var sdk_name)
+function(find_darwin_sdk_dir var sdk_name)  
+  if(DARWIN_${sdk_name}_CACHED_SYSROOT)
+    set(${var} ${DARWIN_${sdk_name}_CACHED_SYSROOT} PARENT_SCOPE)
+    return()
+  endif()
   # Let's first try the internal SDK, otherwise use the public SDK.
   execute_process(
     COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path
@@ -26,6 +32,7 @@
   if(result_process EQUAL 0)
     set(${var} ${var_internal} PARENT_SCOPE)
   endif()
+  set(DARWIN_${sdk_name}_CACHED_SYSROOT ${var_internal} CACHE STRING "Darwin SDK path for SDK ${sdk_name}." FORCE)
 endfunction()
 
 # There isn't a clear mapping of what architectures are supported with a given


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34736.105472.patch
Type: text/x-patch
Size: 1235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170706/271abb65/attachment.bin>


More information about the llvm-commits mailing list