Add the autorevision code in cmake.

Also remove the, now obsolete, subversion version.
The code is based on the code in master.
Thanks to shadowmaster for reminding me about 1.10.