cmake: fix Linux system OpenEXR detection#16294
cmake: fix Linux system OpenEXR detection#16294opencv-pushbot merged 1 commit intoopencv:3.4from h6197627:master
Conversation
|
The solution works for me at least with Ubuntu 16.04. |
|
This patch should go into 3.4 branch first. We will merge changes from 3.4 into master regularly (weekly/bi-weekly). So, please:
Note: no needs to re-open PR, apply changes "inplace". |
alalek
left a comment
There was a problem hiding this comment.
ignores empty suffix ("") while iterating in FOREACH loop
Yes, it is known CMake behavior.
So lets "iterate" through macro helper (something like this).
- SET(LIBRARY_SUFFIXES
- "-${OPENEXR_VERSION}" "-${OPENEXR_VERSION}"
- "-${OPENEXR_VERSION}_s" "-${OPENEXR_VERSION}_s"
- "-${OPENEXR_VERSION}_d" "-${OPENEXR_VERSION}_d"
- "-${OPEXEXR_VERSION}_s_d" "-${OPEXEXR_VERSION}_s_d"
- ""
- "_s" "_s"
- "_d" "_d"
- "_s_d") "_s_d")
- FOREACH(LIBRARY_SUFFIX ${LIBRARY_SUFFIXES}) FOREACH(LIBRARY_SUFFIX ${LIBRARY_SUFFIXES})
+ macro(ocv_find_openexr LIBRARY_SUFFIX)
... current loop code, remove/replace "break()" ...
- endforeach()
+ endmacro()
+ endmacro()
+ macro(ocv_try_openexr LIBRARY_SUFFIX)
+ if(NOT OPENEXR_FOUND) # find first guard
+ ocv_find_openexr(${LIBRARY_SUFFIX})
+ endif()
+ endmacro()
+
+ ocv_try_openexr("-${OPENEXR_VERSION}"
+ ocv_try_openexr("-${OPENEXR_VERSION}_s")
+ ocv_try_openexr("-${OPENEXR_VERSION}_d")
+ ocv_try_openexr("-${OPEXEXR_VERSION}_s_d")
+ ocv_try_openexr("")
+ ocv_try_openexr("_s")
+ ocv_try_openexr("_d")
+ ocv_try_openexr("_s_d")
cmake/OpenCVFindOpenEXR.cmake
Outdated
| if(X86_64) | ||
| SET(OPENEXR_LIBSEARCH_SUFFIXES x86_64-linux-gnu) | ||
| elseif(X86) | ||
| SET(OPENEXR_LIBSEARCH_SUFFIXES i386-linux-gnu) |
There was a problem hiding this comment.
Consider using CMAKE_LIBRARY_ARCHITECTURE variable instead.
cmake/OpenCVFindOpenEXR.cmake
Outdated
| string(TOUPPER "${LIBRARY_NAME}" LIBRARY_NAME_UPPER) | ||
| FIND_LIBRARY(OPENEXR_${LIBRARY_NAME_UPPER}_LIBRARY | ||
| NAMES ${LIBRARY_NAME}${LIBRARY_SUFFIX} | ||
| NAMES ${LIBRARY_NAME} ${LIBRARY_NAME}${LIBRARY_SUFFIX} |
There was a problem hiding this comment.
This would re-introduce mess with names again.
All libraries for found components must have the same suffix. Different subsets must be forbidden.
|
@h6197627 friendly reminder |
|
@asmorkalov, I rebased and tried to address @alalek comments |
|
@h6197627 Looks good to me. Please squash the commits and I'll merge the patch. |
|
@asmorkalov, done |
|
👍 |
resolves #16293