We generalize a maximum principle for optimal control problems involving sweeping systems previously derived in de Pinho et al. (Optimization 71(11):3363–3381, 2022, https://doi.org/10.1080/02331934.2022.2101111) to cover the case where the moving set may be nonsmooth. Noteworthy, we consider problems with constrained end point. A remarkable feature of our work is that we rely upon an ingenious smooth approximating family of standard differential equations in the vein of that used in de Pinho et al. (Set Valued Var Anal 27:523–548, 2019, https://doi.org/10.1007/s11228-018-0501-8).