Why did you remove this lines? It fixes build issues on desktop. Could you just disable it only for dynamic linkage?

    if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA)