[CMake] SWIG generated .cxx file location issue.

Hugh Sorby h.sorby at auckland.ac.nz
Tue Sep 25 19:10:43 EDT 2012


I am wrapping a library with SWIG and using CMake to generate the build 
scripts for me, this is all working really well.  My issue is the 
location of the generated .cxx files.
I have my code laid out as follows:

swig/interface/*.i <-- swig interface files
python/CMakeLists.txt  <-- Python CMakeLists.txt file
build-python2.7 <-- binary build directory

In the python/CMakeLists.txt I have a source file defined relative to 
the current cmake directory, like so:

set(SRC_FILE ../swig/interface/context.i)

When I execute the build command in build-python2.7 the generated .cxx 
files are created in the swig/interface directory.  This is in the 
source tree and I do not want them there.  So my question is how do I 
stop those intermediate .cxx files from being created in my source 
tree?  or How do other users stop those intermediate .cxx files from 
being created in their source tree?

Thanks,
Hugh.


More information about the CMake mailing list