Added the versioning machinery.

This machinery involves the creation of version.h and buildno.h. I also
fixed a typo in the CMake cross-definition file.