MantisBT - CMake
View Issue Details
0014459CMakeCMakepublic2013-10-04 06:332014-06-02 08:37
Joakim Söderberg 
jschueller 
normalminoralways
closedduplicate 
CMake 2.8.9 
CMake 3.0 
0014459: SWIG_ADD_MODULE does not create sub directory
When using SWIG_ADD_MODULE to create wrappers, passing the input file from a sub directory there will be an error when trying to build since swig tries to write it's output to a directory that does not exist.

The example works fine:
SWIG_ADD_MODULE(example python example.i example.cxx)

This does not work (the input is in a subdirectory):
SWIG_ADD_MODULE(example python subdir/example.i subdir/example.cxx)

This will result in the following error (since SWIG tries to write it's ouput file to a non-existing directory under the build dir)

Unable to open file ****/build/subdir/examplePYTHON_wrap.c: No such file or directory

This can be fixed by manually creating the directory:
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/subdir)

This is not obvious or mentioned in the documentation. SWIG_ADD_MODULE should create the directory it's trying to output to.
No tags attached.
duplicate of 0013173closed jschueller Swig module can't handle absolute path 
related to 0013772closed jschueller UseSWIG.cmake does not handle relative paths with parent directories 
Issue History
2013-10-04 06:33Joakim SöderbergNew Issue
2013-11-25 08:28Brad KingAssigned To => jschueller
2013-11-25 08:28Brad KingStatusnew => assigned
2013-11-25 08:28Brad KingRelationship addedrelated to 0013173
2013-11-25 08:29Brad KingRelationship addedrelated to 0013772
2013-11-25 09:11jschuellerRelationship replacedduplicate of 0013173
2013-11-25 09:11jschuellerStatusassigned => resolved
2013-11-25 09:11jschuellerFixed in Version => CMake 3.0
2013-11-25 09:11jschuellerResolutionopen => duplicate
2014-06-02 08:37Robert MaynardNote Added: 0036028
2014-06-02 08:37Robert MaynardStatusresolved => closed

Notes
(0036028)
Robert Maynard   
2014-06-02 08:37   
Closing resolved issues that have not been updated in more than 4 months.