Lay out your foundation on the ground. Tap a stake into each corner with a hammer. Drive two corner stakes directly into the ground touching the foundation of the existing building where you want the buildings to join.
Hook the tip of the tape measure to the tip of one of the stakes touching the existing foundation. Walk diagonally across to the corresponding stake and measure to the tip of that stake. Write down the measurement.
Place the tip of the tape measure on the other stake touching the foundation. Walk diagonally to the corresponding stake and take the measurement. You should have taken measurements across the foundation in an "X" pattern.
Compare the two measurements. If the foundation is perfectly square the measurements will be exactly the same. If the measurements are off, pull up one of the stakes on the outside perimeter and move it either out further, or toward the existing building a few inches.
Check the measurements again by measuring the "X" pattern. If the measurements are still not equal, move the outside stakes in or out again and measure until the two measurements are equal.