Spontaneous CP violation on the lattice