title: How to compile OpenCV with OpenMP
body: <p>A user in <a href="https://stackoverflow.com/questions/28938644/opencv-multi-core-support">this SOF post</a> suggests building OpenCV with a <code>WITH_OPENMP</code> flag to enable (some) multi-core support. I have tried building OpenCV-2.4.10 with OpenMP but I am unable to then import cv2 in Python.</p>
  
  <p><strong>Note:</strong> I am able to build and use OpenCV-2.4.10 in Python. The problem is building with the <code>WITH_OPENMP</code> flag. </p>
  
  <p>I am replacing lines 49-58 in <code>opencv-2.4.10/cmake/OpenCVFindLibsPerf.cmake</code>, as suggested in <a href="http://answers.opencv.org/question/20955/enabling-openmp-while-building-opencv-libraries/" rel="nofollow noreferrer">this</a> blog post, with the following:</p>
  
  <pre><code># --- OpenMP ---
  if(NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
    include (FindOpenMP)      # --- since cmake version 2.6.3 
     if (OPENMP_FOUND)
        set (HAVE_OPENMP TRUE)
        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
     else()
        set ( HAVE_OPENMP FALSE)
     endif()
  else()
  set(HAVE_OPENMP 0)
  endif()
  </code></pre>
  
  <p>And then executing this command before building:</p>
  
  <pre><code>    cmake -D WITH_OPENMP=ON -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON \
      -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON  \
      -D BUILD_EXAMPLES=ON ..
  </code></pre>
  
  <p>Is <code>WITH_OPENMP=ON</code> the correct flag to use here? Does the problem lie with using OpenCV-2.4.10? (I notice the blog post I referenced is with OpenCV-2.4.6.1) </p>