[Openmp-commits] [openmp] 62ff9ac - [OpenMP] Use Clang resource dir only in bootstrapping build (#156018)

via Openmp-commits openmp-commits at lists.llvm.org
Sat Aug 30 07:28:35 PDT 2025


Author: Michael Kruse
Date: 2025-08-30T16:28:31+02:00
New Revision: 62ff9ac4c68f48c089528105259c68943ab176de

URL: https://github.com/llvm/llvm-project/commit/62ff9ac4c68f48c089528105259c68943ab176de
DIFF: https://github.com/llvm/llvm-project/commit/62ff9ac4c68f48c089528105259c68943ab176de.diff

LOG: [OpenMP] Use Clang resource dir only in bootstrapping build (#156018)

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.

Added: 
    

Modified: 
    openmp/runtime/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index b22d03d168419..6ac047a833fe5 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -10,11 +10,12 @@
 
 include(ExtendPath)
 
-# The generated headers will be placed in clang's resource directory if present.
-if(NOT LLVM_TREE_AVAILABLE)
-  set(LIBOMP_HEADERS_INTDIR ${CMAKE_CURRENT_BINARY_DIR})
-else()
+# The generated headers will be placed in clang's resource if using it to
+# compile openmp in a runtimes-bootstrapping build.
+if(LLVM_TREE_AVAILABLE AND LLVM_RUNTIMES_BUILD)
   set(LIBOMP_HEADERS_INTDIR ${LLVM_BINARY_DIR}/${LIBOMP_HEADERS_INSTALL_PATH})
+else()
+  set(LIBOMP_HEADERS_INTDIR ${CMAKE_CURRENT_BINARY_DIR})
 endif()
 
 # Configure omp.h, kmp_config.h and omp-tools.h if necessary


        


More information about the Openmp-commits mailing list