Installing CFE 3.7.0 : glitches with CFE OpenMP support if not build in-tree?


I need to install CLang/LLVM 3.7.0 with OpenMP support (libomp), and for various reasons I need to do it with the following configuration :

  • llvm + compiler-rt + openmp installed in some custom folder
  • cfe + clang-tools-extra (depending on the llvm above) as a separate installation somewhere else

Up to now I wasn’t able to configure the build to generate a proper support for OpenMP, as it seems the compiler paths are not set up correctly to find the ‘omp.h’ header when “-fopenmp=libomp” option is passed:

$ clang++ -fopenmp=libomp main.cpp

main.cpp:1:10: fatal error: ‘omp.h’ file not found
#include “omp.h”
1 error generated.

If I add the include path explicitly everything works as expected:

$ clang++ -I/lib/clang/3.7.0/include main.cpp -fopenmp=libomp
$ ./a.out
Hello from thread 0 of 4
Hello from thread 1 of 4
Hello from thread 3 of 4
Hello from thread 2 of 4

Is there any option or definition I overlooked in the documentation that will correctly configure clang to add the “omp.h” include path among the defaults if “-fopenmp=libomp” is given?