Problem building standalone OpenMP libraries

Dear all,

since merging the latest changes from upstream to our downstream codebase, I cannot build standalone OpenMP libraries anymore.

Previously, I built LLVM with OpenMP via -DLLVM_ENABLE_PROJECTS="clang;lld;openmp" and then, for building different “flavors” of the OpenMP libraries, created individual folders and configured their build with something like

cmake -G Ninja <special arguments> <path to llvm-project/openmp>

Now, I get the following error when doing the latter:

CMake Error at .../install/lib/cmake/llvm/LLVMExports.cmake:37 (message):
  Some (but not all) targets in this export set were already defined.

  Targets Defined: omp

It seems like in LLVMExports.cmake, there are omp and omptarget defined as expected targets, which previously was not the case.

I can’t figure out how this is supposed to be built correctly. Any hints would be greatly appreciated.

I made the changes that omp and omptarget are exported to make CMake happy on macOS if OpenMP is built in-tree. I always use standalone build for OpenMP but when I build LLVM I never include OpenMP. That can be a WA for now. I don’t know how LLVM manages other components like clang if you build LLVM with LLVM. I’ll need to take a deeper look at it.

Thanks a lot for your explanations! I’ll try to fix it some way for now. For your interest, I am building on Ubuntu, so that might explain why it behaves differently than on macOS.