diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake index 77c9e5c985..54cec78ba3 100644 --- a/cmake/OpenCVDetectCXXCompiler.cmake +++ b/cmake/OpenCVDetectCXXCompiler.cmake @@ -214,6 +214,9 @@ if(NOT OPENCV_SKIP_CMAKE_CXX_STANDARD) if(CMAKE_CXX11_COMPILE_FEATURES) set(HAVE_CXX11 ON) endif() + if(CMAKE_CXX17_COMPILE_FEATURES) + set(HAVE_CXX17 ON) + endif() endif() if(NOT HAVE_CXX11) ocv_check_compiler_flag(CXX "" HAVE_CXX11 "${OpenCV_SOURCE_DIR}/cmake/checks/cxx11.cpp") diff --git a/cmake/OpenCVFindOpenEXR.cmake b/cmake/OpenCVFindOpenEXR.cmake index 0df626a842..d2f3b57090 100644 --- a/cmake/OpenCVFindOpenEXR.cmake +++ b/cmake/OpenCVFindOpenEXR.cmake @@ -94,17 +94,20 @@ FOREACH(SEARCH_PATH ${SEARCH_PATHS}) IF (${contents} MATCHES "#define OPENEXR_VERSION_MINOR ([0-9]+)") SET(OPENEXR_VERSION_MINOR "${CMAKE_MATCH_1}") ENDIF () + FILE (STRINGS ${OPENEXR_VERSION_FILE} contents REGEX "#define OPENEXR_VERSION_PATCH ") + IF (${contents} MATCHES "#define OPENEXR_VERSION_PATCH ([0-9]+)") + SET(OPENEXR_VERSION_PATCH "${CMAKE_MATCH_1}") + ENDIF () ENDIF () ENDIF () - IF (OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR) - set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}") - ENDIF () + set(OPENEXR_VERSION_MM "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}") + set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}.${OPENEXR_VERSION_MINOR}.${OPENEXR_VERSION_PATCH}") - ocv_find_openexr("-${OPENEXR_VERSION}") - ocv_find_openexr("-${OPENEXR_VERSION}_s") - ocv_find_openexr("-${OPENEXR_VERSION}_d") - ocv_find_openexr("-${OPENEXR_VERSION}_s_d") + ocv_find_openexr("-${OPENEXR_VERSION_MM}") + ocv_find_openexr("-${OPENEXR_VERSION_MM}_s") + ocv_find_openexr("-${OPENEXR_VERSION_MM}_d") + ocv_find_openexr("-${OPENEXR_VERSION_MM}_s_d") ocv_find_openexr("") ocv_find_openexr("_s") ocv_find_openexr("_d") @@ -118,6 +121,7 @@ FOREACH(SEARCH_PATH ${SEARCH_PATHS}) UNSET(OPENEXR_VERSION_FILE) UNSET(OPENEXR_VERSION_MAJOR) UNSET(OPENEXR_VERSION_MINOR) + UNSET(OPENEXR_VERSION_MM) UNSET(OPENEXR_VERSION) ENDFOREACH() @@ -144,6 +148,11 @@ IF(OPENEXR_FOUND) endif() if(NOT OPENEXR_VERSION) SET(OPENEXR_VERSION "Unknown") + else() + if(HAVE_CXX17 AND OPENEXR_VERSION VERSION_LESS "2.3.0") + message(STATUS " OpenEXR(ver ${OPENEXR_VERSION}) doesn't support C++17 and higher. Updating OpenEXR 2.3.0+ is required.") + SET(OPENEXR_FOUND FALSE) + endif() endif() ELSE() IF(OPENEXR_FIND_REQUIRED) diff --git a/doc/tutorials/introduction/config_reference/config_reference.markdown b/doc/tutorials/introduction/config_reference/config_reference.markdown index e6ffbb833c..ff3f4b4331 100644 --- a/doc/tutorials/introduction/config_reference/config_reference.markdown +++ b/doc/tutorials/introduction/config_reference/config_reference.markdown @@ -317,6 +317,8 @@ All libraries required to read images in these formats are included into OpenCV @note OpenJPEG have higher priority than JasPer which is deprecated. In order to use JasPer, OpenJPEG must be disabled. @note (JPEG XL) OpenCV doesn't contain libjxl source code, so `BUILD_JPEGXL` is not supported. +@warning OpenEXR ver 2.2 or earlier cannot be used in combination with C++17 or later. In this case, updating OpenEXR ver 2.3.0 or later is required. + ### GDAL integration `WITH_GDAL` (default: _OFF_)