Copy cmp_version from 3.8 branch as it's not present in old versions.