[CMake] Issue and quick fix with UseSWIG.cmake
Anton Deguet
anton at cs.jhu.edu
Thu Oct 28 16:39:34 EDT 2004
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?
Thanks,
Anton Deguet
--
Anton Deguet Systems Engineer
ERC CISST Johns Hopkins University
http://cisstweb.cs.jhu.edu 410 516 5261
More information about the CMake
mailing list