Skip to content

Commit 5a03823

Browse files
[llvm][cmake] Error when a runtime is in LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES (#109791)
The documentation tells you not to do this: https://llvm.org/docs/CMake.html#llvm-related-variables But until now we did not enforce it. ``` $ cmake ../llvm-project/llvm/ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="pstl" -DLLVM_ENABLE_RUNTIMES="libcxx;pstl" ``` ``` CMake Error at CMakeLists.txt:166 (message): Runtime project "pstl" 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. ```
1 parent 5ee2dea commit 5a03823

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ 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+
164170
# Set a shorthand option to enable the GPU build of the 'libc' project.
165171
option(LIBC_GPU_BUILD "Enable the 'libc' project targeting the GPU" OFF)
166172
if(LIBC_GPU_BUILD)

0 commit comments

Comments
 (0)