Compiling opencv c++ with cuda

There isn’t really a specific combination anymore (previously there were specific combinations of Visual Studio and CUDA). The latest stable version of everything (CUDA 12.1 , OpenCV 4.7.0, VS 2022 and CMake 3.25) should work.

As you haven’t posted the errors I’m going to assume that your error is the same as detailed here

If so you need to use the latest release candidate for CMake 3.26 where the bug is fixed.

In future if you want to build a new library I would advise you to use a stable version of CMake.