Add cmake, fix build issues with latest GCC