A current-mode switching regulator uses a slope compensation circuit that automatically accounts for different inductor values and varying input voltages to generate a slope compensation signal. The slope compensation circuit monitors a voltage across a semiconductor switch to extract an upslope signal that tracks increasing inductor current in the current-mode switching regulator. The slope compensation signal is generated based on the upslope signal and a difference between an input voltage and an output voltage of the current-mode switching regulator.