cmake: added logic for building a tagged commit