Add cmakelist for building in linux, and few fixes to make it compile under gcc