CUDA: Fix crash on linking to a CUDA target without CUDA enabled

Do not try to device link or add CUDA runtime libraries if the language
is not enabled.

Fixes: #18673
Issue: #18614
Status Job ID Name Coverage
  External
passed ghostflow-check-master

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager