Squatting is a funny thing in many places. In Spain you have 48 hours to make a police report. After that evicting squatters will be a many months long legal process during which you'll need to keep paying all the bills and taxes for your property.
In order to avoid squatting, put the property to use or hire a security company. Don't expect the state to provide protection for land that's not being put to use.