[test-suite] Use CMAKE_C_COMPILER as TEST_SUITE_HOST_CC when compiling test-suite tools.
Originally the test-suite tools are configured to compile with cc by default.
This patch updates the the default tool to instead by ${CMAKE_C_COMPILER} that is detected.
Differential Revision: https://reviews.llvm.org/D115042
diff --git a/cmake/modules/Host.cmake b/cmake/modules/Host.cmake
index ef81dee..546acba 100644
--- a/cmake/modules/Host.cmake
+++ b/cmake/modules/Host.cmake
@@ -1,4 +1,10 @@
-set(TEST_SUITE_HOST_CC "cc" CACHE STRING "C compiler targetting the host")
+set(_host_cc_default "cc")
+if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ # If we are using Clang, we can use executable for the host even
+ # if CMake is configured to cross-compile.
+ set(_host_cc_default "${CMAKE_C_COMPILER}")
+endif ()
+set(TEST_SUITE_HOST_CC "${_host_cc_default}" CACHE STRING "C compiler targetting the host")
mark_as_advanced(TEST_SUITE_HOST_CC)
function(llvm_add_host_executable targetname exename)