diff --git a/cmake/OpenCVFindOpenEXR.cmake b/cmake/OpenCVFindOpenEXR.cmake index ef633e853a..133468243a 100644 --- a/cmake/OpenCVFindOpenEXR.cmake +++ b/cmake/OpenCVFindOpenEXR.cmake @@ -9,6 +9,14 @@ # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. # +find_package(OpenEXR 3.0 CONFIG QUIET) +if(TARGET OpenEXR::OpenEXR) + SET(OPENEXR_FOUND TRUE) + SET(OPENEXR_LIBRARIES OpenEXR::OpenEXR) + SET(OPENEXR_VERSION ${OpenEXR_VERSION}) + return() +endif() + SET(OPENEXR_LIBRARIES "") SET(OPENEXR_LIBSEARCH_SUFFIXES "") file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) diff --git a/modules/imgcodecs/src/grfmt_exr.cpp b/modules/imgcodecs/src/grfmt_exr.cpp index 9242871f8d..aaf28eead6 100644 --- a/modules/imgcodecs/src/grfmt_exr.cpp +++ b/modules/imgcodecs/src/grfmt_exr.cpp @@ -56,6 +56,7 @@ #include #include +#include #include #include #include