Use full set of dependencies when test compiling

The old implementation erraneously used only the first argument that was
passed to the testing procedure due to the way lists are passed in CMake
when unquoted. Thus, the test failed for SuiteSparse >= 4.0 which needs
more than one dependency.

Also add dependency to BLAS and LAPACK which was hidden because the
caller already included these itself.