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.