Cmake re-run with cuda code

I face an issue about cmake on windows.

When I build a c++ library, if it has cuda code, then cmake will multiple time on windows (depend on how many cuda_add_library used)

some code snippet: https://paste.ubuntu.com/p/KGPSBPfqKr/

I search the google and find link1 that say it is the expected behavior. But the cmake will not re-run on linux, may be I missed something?

cuda_add_library sounds like an old FindCUDA mechanism. Have you tried using the built-in CUDA support (adding CUDA to the top-level project() call or using enable_language(CUDA)?). I expect that to work far better these days.

Cc: @robert.maynard @brad.king