Thermodynamics of wetting by liquid metals