I am trying to compile with OpenMP. My CMakeLists.txt
contains the line
find_package(OpenMP REQUIRED)
and CMake errors out with
iNFINITEi's answer doesn't work for me.
I use Ubuntu, trying to compile some code with OpenCV
static library. After linking, I got this:
'"/usr/bin/ld: /usr/local/lib/libopencv_core.a(parallel.cpp.o): undefined reference to symbol 'omp_set_dynamic@@OMP_1.0'"'
So I tried iNFINITEi's approach, then I have:
'CMake Error at /usr/local/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:211 (message): No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS() Call Stack (most recent call first): /usr/local/share/cmake-3.13/Modules/FindOpenMP.cmake:513 (find_package_handle_standard_args) CMakeLists.txt:8 (FIND_PACKAGE)'
At last, I add "-fopenmp=libomp"
to CMAKE_CXX_FLAGS
, solved my problem.