Refactor for cmake.