Extract the CMake logic to add SWIG wrapper into helper function defined in the bindings directly. This avoid code duplication between Python and Lua. The function is parameterized in its target, making it possible to add the wrapper to a different target, for example the respective script interpreter plugin when building dynamic plugins.