Cmake: fix error that caused all build versions to be labelled -dirty