Wouldn't use these gears on CNC machine without some form of mechanical fastening.
Would Either buy gears with key ways or have some machined into existing gears. Both Drilling/Taping and keyway cutting could be difficult has they may well be hardened gears.? try a file on them to check before attempting either.

If not then I'd simply drill/tap and use set screw along with Loctite.