Global Nash–Kuiper theorem for compact manifolds