On foot, Google maps gives more than 800 directions to make the journey from Barcelona to Gibraltar, a distance of some 1100 km (and 218 hours non-stop). If that map option doesn’t suit, you could blaze your own trail (and blog about it), leaving Barcelona southwest of the airport and following the coastline, keeping the sea in sight as you go. A coastal route would add both time and distance to the journey. It would help to have a GPS navigation system.
This response in SE The Great Outdoors offered information on good quality walking maps for Spain and the @gerrit suggestion that
Wikiloc is very popular in Spain. Pretty much anywhere you'll go you'll find hundreds of GPS-trails. Even if you do not use a GPS-receiver, you can use those in combination with your map to find out where the trails are. It requires good planning and it's helpful to have access to internet while on your trip.