Made to compile with older g++ and fixed CMake