Prospects for the precision measurement of the W mass with the CMS detector at the LHC