Résumé : The goal of this paper is to present a systematic method to compute reference dependent positively invariant sets for systems subject to constraints. To this end, we first characterize these sets as level sets of reference dependent Lyapunov functions. Based on this characterization and using Sum of Squares theory, we provide a polynomial certificate for the existence of such sets. Subsequently, through some algebraic manipulations, we express this certificate in terms of a Semi-Definite Programming problem which maximizes the size of the resulting reference dependent invariant sets. We then present some results implementing the proposed method to an example and propose some variants that may help in reducing possible numerical issues. Finally, the proposed approach is employed in the Model Predictive Control for Tracking scheme to compute the terminal set, and in the Explicit Reference Governor framework to compute the so-called Dynamic Safety Margin. The effectiveness of the proposed method in each of the schemes is demonstrated through simulation studies.