Morphing aircraft can achieve optimum performances at multiple flight conditions through large geometry deformations. However, to obtain the optimum configurations, optimization design studies are required. A study on aerodynamic optimization of a morphing aircraft was conducted to obtain corresponding optimal configurations at various flight speeds. Firstly, an optimization framework being suitable to a morphing aircraft with larger deformations was established by integrating existing codes, in which aerodynamic forces for the optimization are calculated by an Euler-based solver and friction/form drag estimation code. The solver is based on a Cartesian method in which configurations are modeled in terms of components of aircraft, hence large deformations of morphing aircraft can be performed during the optimization. A surrogate-based model was employed for fitting aerodynamic forces, thus reducing computational cost in a global optimization. A generic morphing aircraft with variable sweep and span was investigated at subsonic, transonic, and supersonic conditions through the optimization process. The target of optimization is to obtain maximum lift-to-drag ratios subject to lift, trim, and static stability constrains at each flight condition. The movement of center-of-gravity of the aircraft was also considered in optimization. The results indicate that the center-of-gravity has an important effect on the optimum configurations obtained, and the aerodynamic performance will be enhanced significantly if the center-of-gravity is moved backward at transonic and supersonic cases. In the case of movable center-of-gravity, the optimum sweep angles increase with the increase in flight speeds, and the optimum spans at transonic and supersonic speeds are smaller than the subsonic case.