diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index c637febce1c1f..330db65e85cab 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -161,6 +161,12 @@ foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES) endif() endforeach() +foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES) + if ("${proj}" IN_LIST LLVM_ENABLE_PROJECTS) + message(FATAL_ERROR "Runtime project \"${proj}\" found in LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES. It must only appear in one of them and that one should almost always be LLVM_ENABLE_RUNTIMES.") + endif() +endforeach() + # Set a shorthand option to enable the GPU build of the 'libc' project. option(LIBC_GPU_BUILD "Enable the 'libc' project targeting the GPU" OFF) if(LIBC_GPU_BUILD)