added cmake support, fixed all warnings