cmake: Cleaned up git version info

If rev and dirty flag are not set properly, the version won't wind up
with a dangling '-' character.