The performance of key tasks in quantum technology, such as accurate state preparation, can be maximized by utilizing external controls and deriving their shape with optimal control theory. For non-pure target states, the performance measure needs to match both the angle and the length of the generalized Bloch vector. A measure based on this simple geometric picture that separates angle and length mismatch into individual terms is introduced and the ensuing optimization framework is applied to maximize squeezing of an optomechanical oscillator at finite temperature. The results herein show that shaping the cavity drives can speed up squeezed state preparation by more than two orders of magnitude. Cooperativities and pulse shapes required to this end are fully compatible with the current experimental technology.