Merge pull request #25941 from cudawarped:cuda_fix_default_cuda_arch_with_cmp0104

`cuda`: prevent `CMAKE_CUDA_ARCHITECTURES` default from overiding OpenCV architecture search (issue 25920)
This commit is contained in:
Alexander Smorkalov 2024-07-24 10:54:17 +03:00 committed by GitHub
commit 14f9d71dd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -726,7 +726,13 @@ if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
cmake_policy(SET CMP0092 NEW) # CMake 3.15+: leave warning flags out of default CMAKE_<LANG>_FLAGS flags.
if(CMAKE_CUDA_COMPILER)
if(CMAKE_CUDA_ARCHITECTURES)
set(USER_DEFINED_CMAKE_CUDA_ARCHITECTURES TRUE)
endif()
enable_language(CUDA)
if(NOT USER_DEFINED_CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES "")
endif()
elseif(UNIX)
message(WARNING "CUDA: Not detected! If you are not using the default host compiler (g++) then you need to specify both CMAKE_CUDA_HOST_COMPILER and CMAKE_CUDA_COMPILER. e.g. -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/clang++ -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc.")
endif()