If it is a small fixture with a standard canopy, I use a surface-mounted pancake box with toggle bolts. The screw holes in the back of the box are far enough apart to span a 1-1/2" pipe which is most likely to be all that you will encounter.
If it is a strip or bar light with a solid back, I just use a Romex connector. If there's not a KO near where it needs to be, I just punch one.