Refactor cmake files.