[CMake] Issue and quick fix with UseSWIG.cmake

Andy Cedilnik andy.cedilnik at kitware.com
Thu Oct 28 17:11:52 EDT 2004


Hi Anton,

This is a bug. Please report it to the bug tracker:
http://www.cmake.org/Bug. It should be fixed soon.

		Andy

On Thu, 2004-10-28 at 16:39, Anton Deguet wrote:
> Hello,
> 
> I'm having a problem with SWIG_ADD_MODULE.  I am trying to wrap the same
> lib for both Python and Tcl from the same interface file.  The interface
> file contains code for both Python and Tcl and is pretty much the same
> except:
> ----- .i file ----
> #if SWIGPYTHON
>   %module myDerivedClassPython
> #endif // SWIGPYTHON
> 
> #if SWIGTCL
>   %module myDerivedClassTcl
> #endif // SWIGTCL
> ---- end of .i file
> 
> In CMakeLists.txt, I have (in a loop):
> ---- CMakeLists.txt ----
>   # Create Python module
>   SWIG_ADD_MODULE(${module}Python python ${interface})
>   SWIG_LINK_LIBRARIES(${module}Python cisstSwigRuntimePython ${module})
> 
>   # Create Tcl module
>   SWIG_ADD_MODULE(${module}Tcl tcl ${interface})
>   SWIG_LINK_LIBRARIES(${module}Tcl cisstSwigRuntimeTcl ${module})
> ---- end of CMakeLists.txt ----
> 
> This leads to multiple ways to create the file ${module}_wrap.cxx.  I
> guess one way to avoid the confusion would be to have the generated file
> named ${module}_${language} but the macro  SWIG_ADD_SOURCE_TO_MODULE
> doesn't have "language" as an input.
> 
> I modified SWIG_ADD_SOURCE_TO_MODULE to have
> SET(swig_generated_file_fullname
>     "${swig_generated_file_fullname}_${name}_wrap")
> This way, the cxx is associated to whatever module I am creating and I
> am creating a more unique name.
> 
> Could this modification make its way to the CVS repository?




More information about the CMake mailing list