Why OpenMP is not Found by Clang#
当使用 clang 作为 C++ 编译器时,CMAKE 无法找到 OpenMP, 如下:
[cmake] -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Solution#
- When using Clang with OpenMP you need to use
-fopenmp=libomp
- 切换 C++ 编译器为 g++,
cmake .. -DCMAKE_C_COMPILER=which gcc -DCMAKE_CXX_COMPILER=which g++