[OpenMP] Use Clang resource dir only in bootstrapping build #156018
Merged
+5
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In an LLVM_ENABLE_PROJECTS=openmp build, the LLVM build tree in which just-built Clang is available, but in contrast to an LLVM_ENABLE_RUNTIMES=openmp build, is not the compiler that openmp is built with (CMAKE_CXX_COMPILER). The latter compiler (which might also be gcc) will not look into the resource directory of just-built Clang, where the OpenMP headers are installed. There may not even be a just-built Clang without LLVM_ENABLE_PROJECTS=clang.
We cannot add the OpenMP header output directory to the search path which also include's Clang's internal headers that will conflict with CMAKE_CXX_COMPILER's internal headers. The only choice left is to use what the OpenMP standalone build does: Use CMAKE_CURRENT_BINARY_DIR which is added unconditionally to the header search path to compile openmp itself.
Note that LLVM_ENABLE_PROJECTS=openmp is deprecated. Consider switching to a LLVM_ENABLE_RUNTIMES=openmp build and supporting removing the LLVM_ENABLE_PROJECTS=openmp build mode.