Skip to content

Fix CUDA version match to ignore patch version #27093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmake/templates/OpenCVConfig-CUDA.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ set(OpenCV_CUDNN_VERSION "@CUDNN_VERSION@")
set(OpenCV_USE_CUDNN "@HAVE_CUDNN@")

if(NOT CUDA_FOUND)
find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
string(REGEX MATCH "^[0-9]+\\.[0-9]+" OpenCV_CUDA_MAJOR_MINOR_VERSION "${OpenCV_CUDA_VERSION}")
find_host_package(CUDA ${OpenCV_CUDA_MAJOR_MINOR_VERSION} REQUIRED)
else()
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_MAJOR_MINOR_VERSION)
message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
endif()
endif()
Expand Down
6 changes: 3 additions & 3 deletions cmake/templates/OpenCVConfig-CUDALanguage.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ if(NOT CUDAToolkit_FOUND)
set(CUDA_PATH "/usr/local/cuda" CACHE INTERNAL "")
set(ENV{CUDA_PATH} ${CUDA_PATH})
endif()
find_package(CUDAToolkit ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
find_package(CUDAToolkit ${OpenCV_CUDA_MAJOR_MINOR_VERSION} EXACT REQUIRED)
else()
message(FATAL_ERROR "Using OpenCV compiled with CUDA as first class language requires CMake \>= 3.18.")
endif()
else()
if(CUDAToolkit_FOUND)
set(CUDA_VERSION_STRING ${CUDAToolkit_VERSION})
endif()
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
message(FATAL_ERROR "OpenCV library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_MAJOR_MINOR_VERSION)
message(FATAL_ERROR "OpenCV library was compiled with CUDA ${OpenCV_CUDA_MAJOR_MINOR_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
endif()
endif()
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy