I use these ways to set a notion that I'm not comfortable when one is cussing or cursing.
a.) Politely tell the friend that you're not comfortable when she/he cusses.
b.) Never cuss yourself, it might imply that cussing is okay with you.
Hope it helps, God bless you. =)