From 91a720144bbf5da08036fdcea698866268227448 Mon Sep 17 00:00:00 2001 From: Benjamin Buch Date: Fri, 14 Nov 2025 15:44:58 +0100 Subject: [PATCH] add MSVC 19.50 / VS 2026 / VC 18 to config: fix #28013 --- cmake/OpenCVDetectCXXCompiler.cmake | 2 ++ .../OpenCVConfig.root-WIN32.cmake.in | 36 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake index a8a6966108..e7fea567ab 100644 --- a/cmake/OpenCVDetectCXXCompiler.cmake +++ b/cmake/OpenCVDetectCXXCompiler.cmake @@ -184,6 +184,8 @@ elseif(MSVC) set(OpenCV_RUNTIME vc16) elseif(MSVC_VERSION MATCHES "^19[34][0-9]$") set(OpenCV_RUNTIME vc17) + elseif(MSVC_VERSION MATCHES "^195[0-9]$") + set(OpenCV_RUNTIME vc18) else() message(WARNING "OpenCV does not recognize MSVC_VERSION \"${MSVC_VERSION}\". Cannot set OpenCV_RUNTIME") endif() diff --git a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in index 62e36272f3..cc9fd8745f 100644 --- a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in +++ b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in @@ -141,15 +141,33 @@ elseif(MSVC) set(OpenCV_RUNTIME vc17) check_one_config(has_VS2022) if(NOT has_VS2022) - set(OpenCV_RUNTIME vc16) - check_one_config(has_VS2019) - if(NOT has_VS2019) - set(OpenCV_RUNTIME vc15) # selecting previous compatible runtime version - check_one_config(has_VS2017) - if(NOT has_VS2017) - set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version - endif() - endif() + set(OpenCV_RUNTIME vc16) # selecting previous compatible runtime version + check_one_config(has_VS2019) + if(NOT has_VS2019) + set(OpenCV_RUNTIME vc15) # selecting previous compatible runtime version + check_one_config(has_VS2017) + if(NOT has_VS2017) + set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version + endif() + endif() + endif() + elseif(MSVC_VERSION MATCHES "^195[0-9]$") + set(OpenCV_RUNTIME vc18) + check_one_config(has_VS2026) + if(NOT has_VS2026) + set(OpenCV_RUNTIME vc17) # selecting previous compatible runtime version + check_one_config(has_VS2022) + if(NOT has_VS2022) + set(OpenCV_RUNTIME vc16) # selecting previous compatible runtime version + check_one_config(has_VS2019) + if(NOT has_VS2019) + set(OpenCV_RUNTIME vc15) # selecting previous compatible runtime version + check_one_config(has_VS2017) + if(NOT has_VS2017) + set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version + endif() + endif() + endif() endif() endif() elseif(MINGW)