-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[libc] Fail fast when building standalone #119426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -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. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems nicer to me to error out, but I'm open to changing this to a warning instead.
@llvm/pr-subscribers-libc Author: Carlo Cabrera (carlocab) ChangesBuilding with the source directory rooted in the libc subdirectory isn't Let's fail fast with a helpful error message instead to help users Full diff: https://github.com/llvm/llvm-project/pull/119426.diff 1 Files Affected:
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)
|
750beba
to
0a88f17
Compare
Building with the source directory rooted in the libc subdirectory isn't tested in CI and can lead to subtle build problems (cf. llvm#118871). Let's fail fast with a helpful error message instead to help users configure libc correctly. Co-authored-by: Nick Desaulniers <[email protected]>
0a88f17
to
24c3680
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.