diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -669,10 +669,6 @@ # first cmake run include(config-ix) -string(REPLACE "Native" ${LLVM_NATIVE_ARCH} - LLVM_TARGETS_TO_BUILD "${LLVM_TARGETS_TO_BUILD}") -list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD) - # By default, we target the host, but this can be overridden at CMake # invocation time. set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -453,13 +453,15 @@ message(FATAL_ERROR "Unknown architecture ${LLVM_NATIVE_ARCH}") endif () -# If build targets includes "host", then replace with native architecture. -list(FIND LLVM_TARGETS_TO_BUILD "host" idx) -if( NOT idx LESS 0 ) - list(REMOVE_AT LLVM_TARGETS_TO_BUILD ${idx}) - list(APPEND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH}) - list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD) -endif() +# If build targets includes "host" or "Native", then replace with native architecture. +foreach (NATIVE_KEYWORD host Native) + list(FIND LLVM_TARGETS_TO_BUILD ${NATIVE_KEYWORD} idx) + if( NOT idx LESS 0 ) + list(REMOVE_AT LLVM_TARGETS_TO_BUILD ${idx}) + list(APPEND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH}) + list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD) + endif() +endforeach() list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX) if (NATIVE_ARCH_IDX EQUAL -1)