Trying to compile Opencv 4.7 with CUDA 12.1 or 11.5 under Visual Studio 2022 and getting errors from the nvcc compiler when compiling the .cu files. The cmake 3.26 generated compile command is :
setlocal
cd D:\Libraries\opencv-4.7.0\build\modules\core\CMakeFiles\cuda_compile_1.dir\src\cuda
if %errorlevel% neq 0 goto :cmEnd
D:
if %errorlevel% neq 0 goto :cmEnd
“C:\Program Files\CMake\bin\cmake.exe” -E make_directory D:/Libraries/opencv-4.7.0/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/$(Configuration)
if %errorlevel% neq 0 goto :cmEnd
“C:\Program Files\CMake\bin\cmake.exe” -D verbose:BOOL=OFF -D “CCBIN:PATH=$(VCInstallDir)Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)” -D build_configuration:STRING=$(ConfigurationName) -D generated_file:STRING=D:/Libraries/opencv-4.7.0/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/$(Configuration)/cuda_compile_1_generated_gpu_mat.cu.obj -D generated_cubin_file:STRING=D:/Libraries/opencv-4.7.0/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/$(Configuration)/cuda_compile_1_generated_gpu_mat.cu.obj.cubin.txt -P D:/Libraries/opencv-4.7.0/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.obj.Debug.cmake
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
I am suspecting something is wrong with this command but don’t know what.
Anyone can understand what the problem might be?