Integrate CMake as git external, fix cppcheck errors