Generalised ext.cmake to allow for dynamic lists of dependencies