diff --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake --- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake +++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake @@ -52,6 +52,11 @@ endif() endforeach() + # if CMAKE_SYSTEM_NAME doesn't get set, CMake will target the host. + if (NOT _cmake_system_name) + set(_cmake_system_name "${CMAKE_HOST_SYSTEM_NAME}") + endif() + if(NOT ARG_TOOLCHAIN_TOOLS) set(ARG_TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objdump) if(_cmake_system_name STREQUAL Darwin)