[libc-commits] [libc] [libc] Fail fast when building standalone (PR #119426)
Carlo Cabrera via libc-commits
libc-commits at lists.llvm.org
Tue Dec 10 10:10:20 PST 2024
https://github.com/carlocab created https://github.com/llvm/llvm-project/pull/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.
>From 6abe590b04b39946668550ac9721c71d3a36412e Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <github at carlo.cab>
Date: Wed, 11 Dec 2024 02:07:10 +0800
Subject: [PATCH] [libc] Fail fast when building standalone
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.
---
libc/CMakeLists.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 6d48489284faef..3ad549a66f14e6 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. "
+ "Please see the documentation at https://libc.llvm.org/usage_modes.html for links to build "
+ "instructions depending how you plan to use libc.")
+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