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. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake |
Hm strange.
I use the swigmodule a lot and it creates my .cxx files in the binary-dir; but I have no relative path in the name of the interface file. Have you tried to use an absolute path like set(SRC_FILE ${CMAKE_SOURCE_DIR}/swig/interface/context.i) ? Relative paths are always a little bit cumbersome; what happens if your build tree is far away from the source tree? Felix |
Finally, I have got around to this again.
My problem is that my swig files are a sibling directory of the python where the CMakeLists.txt file is so I specify the relative path using '..' If I try and pass through the absolute path of the swig interface files I get a CMake error telling me it cannot find the source file! It is trying to append the absolute path onto the current CMAKE_SOURCE_DIR. Which in my case is not a substring of the absolute source file string. If my build tree is located anywhere else, then the directory ../interface probably won't exist and the build will fail when it tries to compile an interface file. Thanks for you suggestion Felix. On 09/27/12 09:42, felix wrote: > Hm strange. > I use the swigmodule a lot and it creates my .cxx files in the binary-dir; > but I have no relative path in the name of the > interface file. > > Have you tried to use an absolute path like > > set(SRC_FILE ${CMAKE_SOURCE_DIR}/swig/interface/context.i) > > ? > Relative paths are always a little bit cumbersome; what happens if your > build tree is far away from the source tree? > > Felix > > > > -- > View this message in context: http://cmake.3232098.n2.nabble.com/SWIG-generated-cxx-file-location-issue-tp7581826p7581836.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake |
In reply to this post by felix
Hi,
I'm still having problems with this. It seems my swig is not creating the output directory for the swig generated cxx file. To get this to work I have had to add a further make_directory command to the custom command to create the required output directory before the file is swigged. I have done some testing and I cannot get any swig output if the .i file is not in the same directory as the CMakeLists.txt file. Any ideas? For reference: cmake version 2.8.10 swig 2.0.8 On 09/27/12 09:42, felix wrote: > Hm strange. > I use the swigmodule a lot and it creates my .cxx files in the binary-dir; > but I have no relative path in the name of the > interface file. > > Have you tried to use an absolute path like > > set(SRC_FILE ${CMAKE_SOURCE_DIR}/swig/interface/context.i) > > ? > Relative paths are always a little bit cumbersome; what happens if your > build tree is far away from the source tree? > > Felix > > > > -- > View this message in context: http://cmake.3232098.n2.nabble.com/SWIG-generated-cxx-file-location-issue-tp7581826p7581836.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake |
Free forum by Nabble | Edit this page |