Linking multiple static cuda libs

Hi,
not sure if this is a cmake problem or a problem with some other part of compilation procedure. I would like link multiple static cuda libraries and in the last step also create an executable. For some reason the following setup is failing:

add_library(lib1 lib1.cu)
target_link_libraries(lib1 PRIVATE CUDA::cudart)
set_target_properties(lib1 PROPERTIES CUDA_SEPARABLE_COMPILATION ON)

add_library(lib2 lib2.cu lib2.cpp)
target_link_libraries(lib2 PRIVATE lib1 CUDA::cudart)
set_target_properties(lib2 PROPERTIES CUDA_SEPARABLE_COMPILATION ON)

add_library(lib3 lib3.cu lib3.cpp)
target_link_libraries(lib3 PRIVATE lib1 CUDA::cudart)
set_target_properties(lib3 PROPERTIES CUDA_SEPARABLE_COMPILATION ON)

add_executable(exec exec.cpp)
target_link_libraries(exec PRIVATE lib2 lib3 CUDA::cudart)
set_target_properties(exec PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)

The last line doesn’t really matter, because cmake does it by default. Above setup produces the following type errors when used with VS2019 generator and msvc compiler:

 error LNK2019: unresolved external symbol __cudaRegisterLinkedBinary_47_t mpxft_00001d9c_00000000_7_NonLinearFit_cpp1_ii_4e207dfe referenced in function

It does compile and run successfully when compiled with ninja generator and clang c++ compiler. I am using the latest cmake, which passes correct flags to the linker (https://gitlab.kitware.com/cmake/cmake/-/issues/18265). I also thought that linking static library with another static library might require CUDA_RESOLVE_DEVICE_SYMBOLS to be turned on, but then I get multiple definitions errors. Changing PRIVATE linking to PUBLIC also makes no difference. Any ideas?

Ok, so it turned out I stumbled across this bug: https://gitlab.kitware.com/cmake/cmake/-/issues/17520 . It links normally if I add dummy.cu to executable.