>>109937328
For reference, this is the command that I use on my machine with multiple CUDA installations to switch between CUDA 11 and 12:
cmake -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_COMPILER=/opt/cuda-11.7/bin/nvcc -DGGML_CUDA_NCCL=OFF -DCMAKE_INSTALL_RPATH="/opt/cuda-11.7/lib64;\$ORIGIN" -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON .. && time cmake --build . -j 32 -- --quiet && echo -e "\a"
Make sure to rebuild your build directory beforehand.