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