[llvm] [llvm][cmake] Error when a runtime is in LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES (PR #109791)
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 05:33:35 PDT 2024
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/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.
```
>From 74891e028e8930e1418ec602d7a14f5a5679650e Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 24 Sep 2024 12:30:43 +0000
Subject: [PATCH] [llvm][cmake] Error when a runtime is in LLVM_ENABLE_PROJECTS
and LLVM_ENABLE_RUNTIMES
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.
```
---
llvm/CMakeLists.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index c637febce1c1fe..330db65e85cabb 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -161,6 +161,12 @@ foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
endif()
endforeach()
+foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
+ if ("${proj}" IN_LIST LLVM_ENABLE_PROJECTS)
+ 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.")
+ endif()
+endforeach()
+
# Set a shorthand option to enable the GPU build of the 'libc' project.
option(LIBC_GPU_BUILD "Enable the 'libc' project targeting the GPU" OFF)
if(LIBC_GPU_BUILD)
More information about the llvm-commits
mailing list