Skip to content

Commit fea1596

Browse files
authored
[llvm][cmake] Do not emit error on libc's use of project + runtime build (#110038)
Summary: The `libc` project automatically adds `libc` to the projects list if it's in the runtimes list. This then causes it to enter the projects directory to bootstrap a handful of utilities, This usage conflicts with a new error message with effectively stopped us from doing this. This patch weakens the error message to permit this single case.
1 parent b856c9f commit fea1596

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

llvm/CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,6 @@ foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
161161
endif()
162162
endforeach()
163163

164-
foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
165-
if ("${proj}" IN_LIST LLVM_ENABLE_PROJECTS)
166-
message(FATAL_ERROR "Runtime project \"${proj}\" found in LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES. It must only appear in one of them and that one should almost always be LLVM_ENABLE_RUNTIMES.")
167-
endif()
168-
endforeach()
169-
170164
# Set a shorthand option to enable the GPU build of the 'libc' project.
171165
option(LIBC_GPU_BUILD "Enable the 'libc' project targeting the GPU" OFF)
172166
if(LIBC_GPU_BUILD)
@@ -204,6 +198,16 @@ if(NEED_LIBC_HDRGEN)
204198
list(APPEND LLVM_ENABLE_PROJECTS "libc")
205199
endif()
206200
endif()
201+
202+
foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
203+
if("${proj}" IN_LIST LLVM_ENABLE_PROJECTS)
204+
# The 'libc' project bootstraps a few executables via the project build and
205+
# should not emit an error currently.
206+
if(NOT (NEED_LIBC_HDRGEN AND "${proj}" STREQUAL "libc"))
207+
message(FATAL_ERROR "Runtime project \"${proj}\" found in LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES. It must only appear in one of them and that one should almost always be LLVM_ENABLE_RUNTIMES.")
208+
endif()
209+
endif()
210+
endforeach()
207211
unset(NEED_LIBC_HDRGEN)
208212

209213
# LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the

0 commit comments

Comments
 (0)