build-libcxx: Set CMAKE_CXX_COMPILER_TARGET when building

LLVM's default host detection doesn't always work (cmake doesn't
detect and provide the target architecture, but it provides the
bitness, thus LLVM's GetHostTriple.cmake guesses on the same
architecture as running the build), thus pass it manually.

This didn't use to matter, as the tests for whether --target=<target>
works used to fail, as the toolchain isn't complete at that point.

But since 7af584ed87cc6eddb6adbc451c90fb8867469e06 in llvm-project
(November 5th 2021), the libunwind cmake tests for --target do
succeed (without noticing that linking actually will fail), and thus
can end up using the incorrectly guessed compiler target.

Thus, this fixes building the runtimes with current git main
versions of llvm-project.
This commit is contained in:
Martin Storsjö committed 2021-11-05 14:38:38 +02:00
1 parent fe57d608de
commit 4b34c42cbc
1 file changed
+3
+3
View File
@@ -93,6 +93,7 @@ build_all() {
-DCMAKE_INSTALL_PREFIX="$PREFIX/$arch-w64-mingw32" \
-DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=$arch-w64-mingw32-clang++ \
-DCMAKE_CXX_COMPILER_TARGET=$arch-w64-windows-gnu \
-DCMAKE_CROSSCOMPILING=TRUE \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER_WORKS=TRUE \
@@ -123,6 +124,7 @@ build_all() {
-DCMAKE_INSTALL_PREFIX="$PREFIX/$arch-w64-mingw32" \
-DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=$arch-w64-mingw32-clang++ \
-DCMAKE_CXX_COMPILER_TARGET=$arch-w64-windows-gnu \
-DCMAKE_CROSSCOMPILING=TRUE \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER_WORKS=TRUE \
@@ -159,6 +161,7 @@ build_all() {
-DCMAKE_INSTALL_PREFIX="$PREFIX/$arch-w64-mingw32" \
-DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=$arch-w64-mingw32-clang++ \
-DCMAKE_CXX_COMPILER_TARGET=$arch-w64-windows-gnu \
-DCMAKE_CROSSCOMPILING=TRUE \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER_WORKS=TRUE \