diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake index 3874467f3a..3489e83286 100644 --- a/cmake/OpenCVDetectCXXCompiler.cmake +++ b/cmake/OpenCVDetectCXXCompiler.cmake @@ -114,7 +114,7 @@ if(MSVC) set(OpenCV_RUNTIME vc12) elseif(MSVC_VERSION EQUAL 1900) set(OpenCV_RUNTIME vc14) - elseif(MSVC_VERSION EQUAL 1910 OR MSVC_VERSION EQUAL 1911 OR MSVC_VERSION EQUAL 1912) + elseif(MSVC_VERSION MATCHES "^191[0-9]$") set(OpenCV_RUNTIME vc15) else() message(WARNING "OpenCV does not recognize MSVC_VERSION \"${MSVC_VERSION}\". Cannot set OpenCV_RUNTIME") diff --git a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in index 846c4008ed..7a9528a97c 100644 --- a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in +++ b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in @@ -78,7 +78,7 @@ if(MSVC) set(OpenCV_RUNTIME vc12) elseif(MSVC_VERSION EQUAL 1900) set(OpenCV_RUNTIME vc14) - elseif(MSVC_VERSION EQUAL 1910 OR MSVC_VERSION EQUAL 1911 OR MSVC_VERSION EQUAL 1912) + elseif(MSVC_VERSION MATCHES "^191[0-9]$") set(OpenCV_RUNTIME vc15) endif() elseif(MINGW)