[libc-commits] [libc] e84566f - [libc] Fail fast when building standalone (#119426)
via libc-commits
libc-commits at lists.llvm.org
Thu Dec 12 01:17:20 PST 2024
Author: Carlo Cabrera
Date: 2024-12-12T17:17:17+08:00
New Revision: e84566ff2b8e9bb67ccc6764d7003871535e550e
URL: https://github.com/llvm/llvm-project/commit/e84566ff2b8e9bb67ccc6764d7003871535e550e
DIFF: https://github.com/llvm/llvm-project/commit/e84566ff2b8e9bb67ccc6764d7003871535e550e.diff
LOG: [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 <nickdesaulniers at users.noreply.github.com>
Added:
Modified:
libc/CMakeLists.txt
Removed:
################################################################################
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 6d48489284faef..88cc75e83b043d 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)
More information about the libc-commits
mailing list