diff --git a/llvm/cmake/modules/LLVM-Config.cmake b/llvm/cmake/modules/LLVM-Config.cmake --- a/llvm/cmake/modules/LLVM-Config.cmake +++ b/llvm/cmake/modules/LLVM-Config.cmake @@ -28,7 +28,9 @@ string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" targets) elseif(ARG_OMITTED_TARGETS) set(omitted_targets ${LLVM_ALL_TARGETS}) - list(REMOVE_ITEM omitted_targets ${LLVM_TARGETS_TO_BUILD}) + if (LLVM_TARGETS_TO_BUILD) + list(REMOVE_ITEM omitted_targets ${LLVM_TARGETS_TO_BUILD}) + endif() string(TOUPPER "${omitted_targets}" targets) else() string(TOUPPER "${LLVM_ALL_TARGETS}" targets)