diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index 6d48489284fae..88cc75e83b043 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required(VERSION 3.20.0) set(LLVM_SUBPROJECT_TITLE "libc") +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + message(FATAL_ERROR "Builds rooted in the libc directory are not supported. " + "Builds should be rooted in the runtimes directory instead. " + "Please see the documentation at https://libc.llvm.org/usage_modes.html for more info.") +endif() + # Include LLVM's cmake policies. if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)