diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 94dabb81484..824d17e7242 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -462,14 +462,16 @@ else() # if this is included from LLVM's CMake list(APPEND ${name}_extra_args "-D${new_name}=${new_value}") endif() endforeach() - foreach(variableName ${variableNames}) - string(FIND "${variableName}" "RUNTIMES_${name}_" out) - if("${out}" EQUAL 0) - string(REPLACE "RUNTIMES_${name}_" "" new_name ${variableName}) - string(REPLACE ";" "|" new_value "${${variableName}}") - list(APPEND ${name}_extra_args "-D${new_name}=${new_value}") - endif() - endforeach() + if(NOT "${name}" STREQUAL "${target}") + foreach(variableName ${variableNames}) + string(FIND "${variableName}" "RUNTIMES_${name}_" out) + if("${out}" EQUAL 0) + string(REPLACE "RUNTIMES_${name}_" "" new_name ${variableName}) + string(REPLACE ";" "|" new_value "${${variableName}}") + list(APPEND ${name}_extra_args "-D${new_name}=${new_value}") + endif() + endforeach() + endif() if(NOT RUNTIMES_${name}_LLVM_ENABLE_RUNTIMES AND NOT RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES) string(REPLACE ";" "|" LLVM_ENABLE_RUNTIMES_PASSTHROUGH "${LLVM_ENABLE_RUNTIMES}")