================
@@ -2,6 +2,24 @@
 
 @SERIALIZED_LIT_PARAMS@
 
+# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/19180.
+#
+# On Apple platforms, CMake resolves the compiler to the final binary using
+# `$(xcrun --find <compiler>`). Unfortunately, running this compiler as-is
+# doesn't work because it doesn't have knowledge of the SDK root. To work
+# around that, we transform the resolved compiler back to the corresponding
+# /usr/bin shim if we can.
+def workaround_cmake_issue_on_Apple(cxx):
----------------
ldionne wrote:

This workaround doesn't change anything non-Apple platforms. `xcrun` doesn't 
exist, so the whole thing will throw an exception and we just use the `cxx` 
that was provided by CMake directly (i.e. `CMAKE_CXX_COMPILER`).

By the way, this increases the "test as we ship" on Apple platforms because 
people on Apple platforms don't run `/path/to/compiler -isysroot <whatever>`, 
they run `clang++` directly and that shim takes care of setting the `SDKROOT` 
environment variable which tells Clang where to look for. If the CMake issue 
linked in the comment were fixed, none of this would be necessary.

https://github.com/llvm/llvm-project/pull/66265
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to