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
This commit is contained in:
Yuantao Feng 2023-01-16 17:44:13 +08:00 committed by GitHub
parent a9d02f096e
commit c63d79c5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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()