It looks like CMAKE_SHARED_LIBRARY_RUNTIME_<LANG>_FLAG is what controls this. I suspect that nvcc is being detected as some other compiler and getting its settings for this instead of something more nvcc-specific.
Can you show what compiler it is being detected as in your setup?
If I print the output of CMAKE_CXX_COMPILER_ID and CMAKE_CXX_COMPILER_VERSION, it shows that this is incorrectly being identified as GNU 12.1.0.
I thought this might have been because I the executable I was actually calling was hipcc (which can front either clang or nvcc depending on GPU setup), but even if I directly call out to nvcc it still thinks it’s GNU 12.1.0.
To set the compiler, I’m explicitly setting CMAKE_CXX_COMPILER to hipcc (or nvcc) prior to calling project(). I understood this was the right way, but I might be wrong.
Nvcc does some other magic including automatically linking in cuda libraries that allows me to avoid having to fuss about their locations from machine to machine. So I’m this case I’d still like to be able to call nvcc as the linker