technically it's not officially supported by nintendo yet (probably will be when smash ultimate drops) but basically i think all you need to do is just use the wii u gamecube adapter and plug it into your dock
First, you need that GameCube controller adapter originally designed for Wii U. If you don't have that adapter, Nintendo will be re-releasing it in December.
Plug that adapter into the Nintendo Switch Dock, and plug your GameCube controller into it. Go to the "add controller" screen and press L and R simultaneously to pair it. It will tell you that a USB controller is connected.
Button mapping is a bit odd and ZR functions are unusable, but if you can live with that, you have yourself a new controller for your Switch.