1. A coordinate measuring machine comprising: an optical sensor for optically capturing a workpiece; an illumination device for illuminating the workpiece, a pose determination unit for determining data relating to a workpiece pose including a position and orientation of the workpiece, a storage unit for storing (i) data relating to a reference pose including a position and orientation of a reference workpiece, and (ii) data relating to a reference light setting of the illumination device used for a measurement of the reference workpiece, and a control unit which is configured to control a light setting of the illumination device for a measurement of the workpiece by adapting the reference light setting based on a comparison of the stored data relating to the reference pose with the determined data relating to the workpiece pose.