This might be tricky, e.g., if tools like nvidia-smi show a newer CUDA version…
You might want to try changing other environment variables like CUDA_BIN_PATH like the cmake docs state: FindCUDA — CMake 3.20.2 Documentation 2