How to get clang with OpenMP working on MSVC 2015

前端 未结 1 1589
天涯浪人
天涯浪人 2021-01-06 13:10

I try to get clang 5.0.0 working for Visual Studio 2015, because I need OpenMP 3.0 features. I installed the clang compiler (not the vs2015 version which does not have any o

相关标签:
1条回答
  • 2021-01-06 14:02

    It is really a bit tricky and the cmake autodetection doesn't seem to work very well. What helped is

    OpenMP_CXX_FLAGS="-Xclang -fopenmp"
    OpenMP_C_FLAGS="-Xclang -fopenmp"
    

    And making sure that libomp.lib is in the link libraries.

    -Xclang tells the clang binary, that the following options are in clang format and not in MSVC format and -fopenmp is then just the usual OpenMP flag. Setting it any other way did not work, though.

    The general pattern is: -Xclang -clangFlag1 -Xclang -clangFlag2.... Namely each Clang Style flag requires its own -Xclang.

    0 讨论(0)
提交回复
热议问题