To shoot photos that are sharp from foreground to infinity, you have to focus at the hyperfocal distance for the lens and aperture you're using.
This 3.5" x 5.5" laminated cheat sheet provides hyperfocal distance data for "full frame" DSLRs (Canon 1Ds/5D - all versions; Nikon D700/D3/D3x/D3s; Sony A850/A900) and 35mm film cameras.