Ported to gcc, added cmake build files