8000 fix: strip patch version from CUDA_VERSION_STRING when using CUDAToolkit (#26965) by WalkingDevFlag · Pull Request #28474 · opencv/opencv · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@WalkingDevFlag
Copy link
Contributor

When ENABLE_CUDA_FIRST_CLASS_LANGUAGE is ON, CUDAToolkit_VERSION may include a patch component
(e.g. 12.3.107). This value is currently exported into OpenCVConfig.cmake and later used
with EXACT matching, which forces an exact patch-level CUDA version match.

This is unnecessarily strict, since CUDA APIs are stable within the same major.minor
version and patch versions change frequently.

This change extracts only the major.minor part (e.g. 12.3) from CUDAToolkit_VERSION before
exporting it, keeping the existing EXACT behavior while allowing any patch version.

This is consistent with existing FindCUDA.cmake behavior, which already operates at the
major.minor level.

Fixes #26965

Note: This change only affects the exported CUDA version string in OpenCVConfig.cmake and does not alter CUDA discovery or compatibility logic.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

When ENABLE_CUDA_FIRST_CLASS_LANGUAGE is ON, CUDAToolkit_VERSION includes
the full patch version (e.g., 12.3.107), causing OpenCVConfig.cmake to
require an exact patch version match. This is overly strict since CUDA
APIs are stable within the same major.minor version.

This fix extracts only major.minor (e.g., 12.3) from CUDAToolkit_VERSION,
which is consistent with the existing FindCUDA.cmake behavior that already
uses only major.minor.

Fixes opencv#26965
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generated OpenCVConfig.cmake wrongly depends on cuda patch version

1 participant

0