Added template, improved cmake-generation