Merge pull request #23095 from fengyuentau:fix_omp_macos

* fix openmp include and link issue on macos

* turn off have_openmp if OpenMP_CXX_INCLUDE_DIRS is empty

* test commit

* use condition HAVE_OPENMP and OpenMP_CXX_LIBRARIES for linking

* remove trailing whitespace

* remove notes

* update conditions

* use OpenMP_CXX_LIBRARIES for linking
pull/23141/head
Yuantao Feng 2 years ago committed by GitHub
parent a9d02f096e
commit c63d79c5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      cmake/OpenCVFindFrameworks.cmake
  2. 4
      modules/core/CMakeLists.txt
  3. 4
      modules/video/CMakeLists.txt

@ -32,6 +32,9 @@ if(WITH_OPENMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
if(DEFINED OpenMP_CXX_INCLUDE_DIRS AND OpenMP_CXX_INCLUDE_DIRS)
ocv_include_directories(${OpenMP_CXX_INCLUDE_DIRS})
endif()
endif()
set(HAVE_OPENMP "${OPENMP_FOUND}")
endif()

@ -168,6 +168,10 @@ if(HAVE_HPX)
ocv_target_link_libraries(${the_module} LINK_PRIVATE "${HPX_LIBRARIES}")
endif()
if(HAVE_OPENMP AND DEFINED OpenMP_CXX_LIBRARIES AND OpenMP_CXX_LIBRARIES)
ocv_target_link_libraries(${the_module} LINK_PRIVATE "${OpenMP_CXX_LIBRARIES}")
endif()
ocv_add_accuracy_tests()
ocv_add_perf_tests()

@ -10,3 +10,7 @@ ocv_define_module(video
python
js
)
if(HAVE_OPENMP AND DEFINED OpenMP_CXX_LIBRARIES AND OpenMP_CXX_LIBRARIES)
ocv_target_link_libraries(${the_module} LINK_PRIVATE "${OpenMP_CXX_LIBRARIES}")
endif()

Loading…
Cancel
Save