Correct use of CMAKE_CUDA_ARCHITECTURES

I was looking for ways to properly target different compute capabilities of cuda devices and found a couple of new policies for 3.18. So I tried (simplified):

cmake_minimum_required(VERSION 3.17 FATAL_ERROR)

cmake_policy(SET CMP0104 NEW)
cmake_policy(SET CMP0105 NEW)
...
add_library(hello SHARED hello.cpp hello.h hello.cu)
set_property(TARGET hello PROPERTY CUDA_ARCHITECTURES 52 61 75)

During configuration I have tried to set CMAKE_CUDA_ARCHITECTURES to 52 61 75 in the GUI, but the compiler test fails with

      Compiling CUDA source file main.cu...

      C:\MyProject\build\vs2019-x64\CMakeFiles\CMakeTmp>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe"  --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.28826\bin\HostX64\x64" -x cu   -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include"     --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static 61 75,code=[compute_52 61 75,sm_52 61 75] -Xcompiler="/EHsc -Zi -Ob0" -g   -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /FdcmTC_e9572.dir\Debug\vc142.pdb /FS /Zi /RTC1 /MDd /GR" -o cmTC_e9572.dir\Debug\main.obj "C:\MyProject\build\vs2019-x64\CMakeFiles\CMakeTmp\main.cu" 

      nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified

Note the strange flag --compile -cudart static 61 75,code=[compute_52 61 75,sm_52 61 75]

I installed CMake 3.17.20200520-g81e8f62 on Windows, I’m using Visual Studio 10.19 (16.7.0 Preview 1.0) with NVidia’s SDK 10.2.

For a correct behavior, you need on-going version 3.18 but requested version3.17.

Try following syntax: cmake_minimum_required(VERSION 3.17...3.18) to get expected behavior regarding new features introduced for future v3.18.