Refactor cmake