There's also a trick called the hyper focal point. At any aperture the depth of field is two thirds in front & one third behind the focal point.

If u use a tripod and stop down around f16 (really slow shutter speed, hence the tripod) and focus two thirds through the landscape everything comes into focus.