[runtimes] Bring back TARGET_TRIPLE

This commit reverts 5099e01568 and 77396bbc98, which broke the build
in various ways. I'm reverting until I can investigate, since that
change appears to be way more subtle than it seemed.

GitOrigin-RevId: 850b57c5fbe7b44d18c9667bb31adfbe307453a6
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c75532b..9eada68 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 "${TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.")
+set(LIBUNWIND_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,6 +167,10 @@
   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 b2cc95d..5be44e5 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -36,8 +36,8 @@
   serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
 endif()
 
-if (LIBUNWIND_TARGET_TRIPLE)
-  serialize_lit_param(target_triple "\"${LIBUNWIND_TARGET_TRIPLE}\"")
+if (TARGET_TRIPLE)
+  serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
 endif()
 
 if (LIBUNWIND_BUILD_32_BITS)