[CMake] SWIG interface file location

Mathieu Malaterre mathieu.malaterre at kitware.com
Fri Feb 10 18:18:10 EST 2006


Brad King wrote:
> James Bigler wrote:
> 
>> So I'm using SWIG to generate an interface file to python.
>>
>> Can I get the interface file (myfile.py) to be built in the library path?
>>
>> I need two things to run the interface.  The myfile.py file and the 
>> _myfile.so library with all the c code.  myfile.py gets placed in a 
>> subdirectory with myfilePYTHON_wrap.cxx.  It works out much better to 
>> have myfile.py be in the same directory as _myfile.so.
>>
>> There doesn't seem to be any options to SWIG_ADD_MODULE that lets me 
>> specify the output directory.
> 
> 
> That is a missing feature from the macro.  You can add a feature request 
> here:
> 
> http://www.cmake.org/Bug
> 
> Meanwhile you can just copy the macro's CMake module into your project 
> and modify it to add the interface.

 From UseSWIG.cmake
...
# To get the actual name of the swig module,
# use: ${SWIG_MODULE_name_REAL_NAME}.
# Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify
# special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add
# special flags to all swig calls.
# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify
# where to write all the swig generated module (swig -outdir option)


Do not open a new bug for that, please
Mathieu


More information about the CMake mailing list