[runtimes] Simplify how we set the target triple
Instead of using TARGET_TRIPLE, which is always set to LLVM_DEFAULT_TARGET_TRIPLE,
use that variable directly to populate the various XXXX_TARGET_TRIPLE
variables in the runtimes.
This re-applies 77396bbc98 and 5099e01568, which were reverted in
850b57c5fbe because they broke the build.
Differential Revision: https://reviews.llvm.org/D106009
GitOrigin-RevId: 395271ad11b8c233db1a4e0e6a76aa52e93e5aec
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9563328..81eddbc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,7 +77,7 @@
cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY
"Install the shared libunwind library." ON
"LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF)
-set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
+set(LIBUNWIND_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.")
set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
set(LIBUNWIND_TEST_LINKER_FLAGS "" CACHE STRING
@@ -167,10 +167,6 @@
set(LIBUNWIND_SYSROOT "${CMAKE_SYSROOT}")
endif()
-if (LIBUNWIND_TARGET_TRIPLE)
- set(TARGET_TRIPLE "${LIBUNWIND_TARGET_TRIPLE}")
-endif()
-
# Configure compiler.
include(config-ix)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 8e7fa44..ae83ea9 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -36,8 +36,8 @@
serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
endif()
-if (TARGET_TRIPLE)
- serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
+if (LIBUNWIND_TARGET_TRIPLE)
+ serialize_lit_param(target_triple "\"${LIBUNWIND_TARGET_TRIPLE}\"")
endif()
if (LIBUNWIND_BUILD_32_BITS)