MantisBT - CMake
View Issue Details
0013857CMakeModulespublic2013-01-18 05:502016-06-10 14:31
Mika Fischer 
Kitware Robot 
normalminoralways
closedmoved 
x86LinuxArch
CMake 2.8.10.2 
 
0013857: Cannot generate swig wrapper for python2 and python3 in the same project
The problem is that the wrapper library target has the same name for both wrappers. I've come up with a patch that allows to use PYTHON2 and PYTHON3 as languages for the swig macros, which then use different names for the library targets. I don't know if this is the best way to solve this though...
No tags attached.
patch swig-python2-python3.patch (2,447) 2013-01-18 05:50
https://public.kitware.com/Bug/file/4617/swig-python2-python3.patch
Issue History
2013-01-18 05:50Mika FischerNew Issue
2013-01-18 05:50Mika FischerFile Added: swig-python2-python3.patch
2013-11-30 19:54jschuellerNote Added: 0034617
2013-11-30 19:54jschuellerNote Edited: 0034617bug_revision_view_page.php?bugnote_id=34617#r1324
2013-11-30 20:03jschuellerNote Edited: 0034617bug_revision_view_page.php?bugnote_id=34617#r1325
2016-06-10 14:28Kitware RobotNote Added: 0042202
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0034617)
jschueller   
2013-11-30 19:54   
(edited on: 2013-11-30 20:03)
A current limitation of useswig macro is that the target module library has the same name as the internal swig module internal name ; this prevents to build two swig modules from the same module.i

This could be worked around by providing a target name and a module name to swig_add_module for example.

But for python2 and python3, you will face some other problems ; the findpythonlibs won't allow you to find libpython3 and libpython2 at the same time, (and for other findXXX macros regarding different versions too afaik).
For this case I suggest you to call cmake twice for each version of python. This can even be done in the same build dir so as to keep the lib binaries your bindings rely on.

I'll try to find a backward compatible way to provide the target/module name.

(0042202)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.