Generate version for Windows while build. Rebased #6406 by
RadarNyan