Make sure openmp include dir is added to compiler include dirs
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
- [x] The PR is proposed to proper branch
- [x] There is reference to original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
Fixes #18478
I'm not sure where to link to OpenMP_CXX_LIBRARIES. This variable doesn't seem to be required everywhere, but it is on macos, linking to the OpenMP::OpenMP_CXX target brings in compiler options I think, but apparently not the libomp runtime library, not on macos anyways.
I tried adding it in modules/core/cmake/parallel/detect_openmp.cmake to ocv_add_external_target(), but it seems to do nothing, the file is not even used (tried fatal-erroring inside to no effect).
modules/core/misc/plugins/parallel_openmp/CMakeLists.txt seemingly also unused.
OpenMP gets enabled apparently anyhow, though the process is mysterious to me.
I find no place to link to OpenMP_CXX_LIBRARIES that would actually make its contents (/usr/local/lib/libomp.dylib for me) appear in the verbose make output, so it seems like it's never getting linked.
@themightyoarfish Friendly reminder.
Awaiting feedback.
On May 20, 2022 9:49:14 AM GMT+02:00, Alexander Smorkalov @.> wrote: @. Friendly reminder.
-- Reply to this email directly or view it on GitHub: https://github.com/opencv/opencv/pull/21427#issuecomment-1132590395 You are receiving this because you were mentioned.
Message ID: @.***>
I've update this to hopefully work with old cmake as well. OpenMP_CXX_INCLUDE_DIRS will simply be empty, which is ok, and I am checking for the OpenMP:: library target to exist before linking to it.
superseded by #23095