Unfortunately there is no definite solution. We use a mixture of ultrasonic devices, water pistols (having them ready loaded on an upstairs windowsill helps), handfuls of gravelly soil which will scare but do not injure, and holly and mahonia leaves in certain places.
I long for the day when allowing cats to roam freely is illegal, as I believe it is in parts of Australia.
There is a child of 6 or 7 years in a nearby town, blinded from cats mess. The family had never owned a cat, they moved into a house which had cats in neighbouring homes. How someone's right to let their cat shit in other people's gardens is more important than a child's sight is utterly beyond my comprehension.