It all depends on the type of fixture. Post a pic.
If it's a bath bar type, you can install the box to the side and drill a 1/2 hole in the fixture, install a protective plastic bushing and feed the wires thru.
You can also slip a 1x4 in thru the hole, attach it with dwall screws thru the dwall then mount a pancake box to it.
Do you need to mount a box for the light?
Most fixtures will require a box. There are some that I would consider safe to use without a box...... like a bath bar with completely enclosed back piece (no huge holes in it)