Merge pull request #296 from eile/master

Integrate CMake as git external, fix cppcheck errors
Fix OS X build