Have you considered GetPrerequisites.cmake or BundleUtilities.cmake?
http://www.cmake.org/cmake/help/v3.0/module/GetPrerequisites.html
http://www.cmake.org/cmake/help/v3.0/module/BundleUtilities.html
It sounds like exactly what you're asking for.
HTH,
David C.