As others have said, it depends on the tools you are using.
Do you need to do finite (large) control deflections, or would you be satisfied with small deflections appropriate for computing control surface derivatives?
Are you using the Cart3D shape optimization framework? OpenVSP will read and write Cart3D optimization framework *.xddm files natively. It takes about a two line script to wrap OpenVSP and make it work with the Cart3D framework. It has been years since I have used any of that stuff, but it should all still work fine.
If you can be satisfied with small deflections, then you can use the control surface subsurface modeling capability in OpenVSP. You will need to run CompGeom in OpenVSP to imprint the control surface on the wing. You can then use the adjoint version of Cart3D to calculate control surface derivatives for a 'virtual' control surface deflection. This will require one Cart3D solve and (typically) six adjoint solves -- one for each quantity you want a derivative of -- three forces and three moments.
It won't really be appropriate to do this in conjunction with a larger optimization study -- OpenVSP's CompGeom is not smart enough to finite difference the geometry and to propagate those derivatives through to the optimization framework. On the other hand, you could use CompGeom for the wing only (to impress the control surface shape into the wing mesh) and then combine that with the rest of the geometry using Cart3D's Intersect. That will work as long as you aren't taking any wing variable derivatives. This is because CompGeom will not guarantee to deliver an identical mesh topology as the wing/control surface changes...
The other approach will be to model the control surfaces as separate components -- they can be built into the model using hinge lines (as Brandon said). You can then deflect them as much or as little as you want -- if you want to use the adjoint to calculate their derivative, you can just feed the framework the rotation about the hinge line and go from there.
Check out AIAA 2015-1016. I believe there is a preprint copy available on the OpenVSP website if you don't have access. Section 4C is a control surface example that you might find interesting.
Rob