<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68895>68895</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang][OpenMP] Building clang with openmp runtime as a cmake subproject fails
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
theComputeKid
</td>
</tr>
</table>
<pre>
I would like to build clang as part of a cmake project. In my main `CMakeLists.txt`, I add:
```
include(FetchContent)
FetchContent_Declare(
llvm-project
GIT_REPOSITORY https://github.com/llvm/llvm-project.git
GIT_TAG llvmorg-17.0.2
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
SOURCE_SUBDIR llvm
)
FetchContent_MakeAvailable(llvm-project)
```
I then send the following flags to my project, that are then passed down to LLVM:
```
"LLVM_ENABLE_PROJECTS": "clang;openmp"
```
Everything works.
Now, I change the flags to:
```
"LLVM_ENABLE_PROJECTS": "clang"
"LLVM_ENABLE_RUNTIMES" : "openmp"
```
I get the following error:
```
The dependency target "clang" of target "check-openmp" does not exist.
```
This is on an Apple Silicon Mac. A similar issue has been reported here by others, but left unanswered:
[https://discourse.llvm.org/t/dependency-errors-when-building-as-subdirectory/72830](url)
For context, the use case is to do the following in one project:
1. Build clang with OpenMP.
2. Build my code with that clang.
It works, but only when openmp is specified as a project, but not as a runtime.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVVuP4jYU_jXm5YgoGMLlgQeu27TMMAKmVZ9GTnxI3HHsyHaG4d9XTgIbRtvVVkIGzs3n-87FzFqRKcQ5iZYkWvdY5XJt5i7HlS7KyuEfgvcSza_zGC66khykeEdwGpJKSA6pZCoDZqFkxoE-A4O0YO8IpdH_YOoCiBUUVyiYUEDG4eqJveNOWGcD9-nIOCR0BTEwzslwQcI1CW_nOGw_9V-hUllxJHS6RZfmK60cKkforFF3hW9rTCUz3rZRgpQf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