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