A general-mass scheme for prompt charm production at hadron colliders