The three-loop beta-function of SU(N) lattice gauge theories with Wilson fermions