[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 33cabda..584bcbd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,7 +111,7 @@
set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Define suffix of library directory name (32/64)")
option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON)
-set(LIBCXXABI_TARGET_TRIPLE "${TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.")
+set(LIBCXXABI_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
@@ -273,6 +273,10 @@
set(LIBCXXABI_SYSROOT "${CMAKE_SYSROOT}")
endif()
+if (LIBCXXABI_TARGET_TRIPLE)
+ set(TARGET_TRIPLE "${LIBCXXABI_TARGET_TRIPLE}")
+endif()
+
# Configure compiler. Must happen after setting the target flags.
include(config-ix)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0003449..788fd5a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -86,8 +86,8 @@
serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
endif()
-if (LIBCXXABI_TARGET_TRIPLE)
- serialize_lit_param(target_triple "\"${LIBCXXABI_TARGET_TRIPLE}\"")
+if (TARGET_TRIPLE)
+ serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
endif()
if (LIBCXXABI_BUILD_32_BITS)