added snippets to cmake and corrected some in cpp