Better buildFile function for cmake buildsystem