Roca and Rocha are common and old Portuguese words. The first can mean several things, but in old Portuguese also meant Rock or Cliff (while the second means only rock).
Also a Cape, like any other place, can be named after anything. Old maps of Portugal referred the place as the Roca, so Spain has not relation whatsoever to it.The word itself have Latin or pre-Latin roots, and probably entered the Portuguese via Occitan or Catalan languages, way before Spain's unification. The word rocha probable root is medieval French.