Optimal control problems of semilinear partial differential equations with finite-dimensional control space