Ported build system to cmake