I am trying to enable the new C++20 support in CUDA 12 in Visual Studio 2022 using CMake 3.25. If I set these variables
set(CMAKE_CUDA_STANDARD 20) # works with 17, but not 20
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
then when my project is declared
project(Foo LANGUAGES CXX CUDA)
It gives an error: Target "Foo" requires the language dialect "CUDA20" . But the current compiler "NVIDIA" does not support this, or CMake does not know the flags to enable it.
I have spent a day trying setting other variables, passing command-line arguments to nvcc.exe, etc. but nothing has worked. The CUDA 12 documentation has also not helped me. I made absolutely sure that there is only one nvcc.exe on my entire system, and it's found in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\bin.
Any ideas how to get C++20 working with CUDA 12?