MantisBT - CMake
View Issue Details
0013029CMakeModulespublic2012-03-08 08:472014-06-02 08:37
Fabian Hachenberg 
jschueller 
normalminoralways
closedduplicate 
IntelSuse Linux Enterprise10.4
CMake 2.8.7 
CMake 3.0 
0013029: Use of SWIG fails for out-of-source builds, if the swig interface file is not placed in same directory as CMakeLists.txt
 *simple library project (see attached minimal example)
 *SWIG is employed to create C#-Wrapper
 *SWIG interface file Hello.i is placed in subfolder swig/
 *in-source build works
 *out-of-source build does complain that it cannot find the wrapper files created by SWIG in subfolder swig/
 *it turns out, that no wrapper source files are created
 *CMAKE_SWIG_OUTDIR is undefined
 *it seems to be irrelevant, where actual source files are placed

As a workaround you can either
 *place Hello.i in the main folder (where CMakeLists.txt relies)
 *add output directory manually: set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/swig)

use example project (attached file)

cd build
cmake ..
make

No tags attached.
duplicate of 0013772closed jschueller UseSWIG.cmake does not handle relative paths with parent directories 
gz swig_outdir.tar.gz (800) 2012-03-08 08:48
https://public.kitware.com/Bug/file/4252/swig_outdir.tar.gz
Issue History
2012-03-08 08:47Fabian HachenbergNew Issue
2012-03-08 08:48Fabian HachenbergFile Added: swig_outdir.tar.gz
2012-07-22 11:10CDNote Added: 0030105
2013-11-26 03:07jschuellerAssigned To => jschueller
2013-11-26 03:07jschuellerStatusnew => assigned
2013-11-26 03:07jschuellerRelationship addedduplicate of 0013772
2013-11-26 03:07jschuellerStatusassigned => resolved
2013-11-26 03:07jschuellerFixed in Version => CMake 3.0
2013-11-26 03:07jschuellerResolutionopen => duplicate
2014-06-02 08:37Robert MaynardNote Added: 0036033
2014-06-02 08:37Robert MaynardStatusresolved => closed

Notes
(0030105)
CD   
2012-07-22 11:10   
This happens because the directory that swig tries to write its wrapper code source file does not exist. A fix is to have cmake create the file before swig is called. See issue 0013042.
(0036033)
Robert Maynard   
2014-06-02 08:37   
Closing resolved issues that have not been updated in more than 4 months.