cuda: prevent CMAKE_CUDA_ARCHITECTURES default from overiding OpenCV architecture search

This commit is contained in:
cudawarped 2024-07-22 18:00:36 +03:00
parent c9b57819b1
commit 012d853474

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()