swift
4921eaf9 - [CMake] Avoid stomping cache variables when cross-compiling (#76054)

Commit
1 year ago
[CMake] Avoid stomping cache variables when cross-compiling (#76054) If one is building unified and also cross-compiling (for example building from Linux x86_64 to Linux aarch64), these variables which are normally set in the cache pointing to a native toolchain are overwritten unconditionally pointing to the `CMAKE_BINARY_DIR`, which can be incompatible with the build machine. The value of `SWIFT_NATIVE_CLANG_TOOLS_PATH` is eventually passed to the Swift compiler as `-tools-directory`, which the new `swift-driver` actually seems to use to find `swiftc`. When the `swift-driver` tries to use the incompatible `swiftc`, it returns with a very unhelpful "error: failed to retrieve frontend target info". Avoiding overwriting the variables when cross-compiling lets the build system use the variables provided in the cache, which point to correct binaries for the build machine.
Author
Parents
Loading