Skip to content

Commit e84566f

Browse files
[libc] Fail fast when building standalone (#119426)
Building with the source directory rooted in the libc subdirectory isn't tested in CI and can lead to subtle build problems (cf. #118871). Let's fail fast with a helpful error message instead to help users configure libc correctly. Co-authored-by: Nick Desaulniers <[email protected]>
1 parent 2a825cd commit e84566f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libc/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
cmake_minimum_required(VERSION 3.20.0)
22
set(LLVM_SUBPROJECT_TITLE "libc")
33

4+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
5+
message(FATAL_ERROR "Builds rooted in the libc directory are not supported. "
6+
"Builds should be rooted in the runtimes directory instead. "
7+
"Please see the documentation at https://libc.llvm.org/usage_modes.html for more info.")
8+
endif()
9+
410
# Include LLVM's cmake policies.
511
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
612
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)

0 commit comments

Comments
 (0)