add_custom_target: Fix regression with Fortran sources
Since !8772 (merged) we accidentally try to compute link information for custom targets if they have Fortran sources. For module dependencies, we only need to consider target types that can compile.
Also fix up the test suite a bit to organize these things.
Cc: @scivision
Fixes: #25252 (closed)
Backport: release
Edited by Brad King