MantisBT - CMake
View Issue Details
0014520CMakeCMakepublic2013-10-29 04:082014-06-02 08:37
Adrien Bruneton 
jschueller 
normalmajoralways
closedfixed 
AllAllAll
CMake 2.8.12 
CMake 3.0 
0014520: UseSWIG module can generate too long command lines in the build chain
The macro SWIG_ADD_SOURCE_TO_MODULE in the standard module UseSWIG can potentially generate too long command lines in the build chain, making the build fail. This macro is called by SWIG_ADD_MODULE (main entry point).
The problem typically appears first under Windows (which has tighter restrictions in terms of maximal command line length).

In complex projects it is often the case that identical include directories are repeated several times. The CMake command INCLUDE_DIRECTORIES deals with this situation nicely and only keeps one instance of each directory, and hence one iteration of the "-I/a/b/c" directive. This is not the case when invoking SWIG_ADD_MODULE: the "-I/a/b/c" directive is repeated as many times as the (same) directory was included.
Call SWIG_ADD_MODULE macro in a subdirectory performing (many) redundant includes.
Below a proposed patch to the file UseSWIG.cmake helping mitigating the issue.
No tags attached.
patch patch-UseSWIG.patch (62) 2013-10-29 04:08
https://public.kitware.com/Bug/file/4928/patch-UseSWIG.patch
Issue History
2013-10-29 04:08Adrien BrunetonNew Issue
2013-10-29 04:08Adrien BrunetonFile Added: patch-UseSWIG.patch
2013-10-29 04:46Rolf Eike BeerAssigned To => Mathieu Malaterre
2013-10-29 04:46Rolf Eike BeerStatusnew => assigned
2013-11-25 08:25Brad KingAssigned ToMathieu Malaterre => jschueller
2013-11-25 09:18jschuellerNote Added: 0034550
2013-11-25 09:18jschuellerStatusassigned => resolved
2013-11-25 09:18jschuellerFixed in Version => CMake 3.0
2013-11-25 09:18jschuellerResolutionopen => fixed
2014-06-02 08:37Robert MaynardNote Added: 0036031
2014-06-02 08:37Robert MaynardStatusresolved => closed

Notes
(0034550)
jschueller   
2013-11-25 09:18   
http://cmake.org/gitweb?p=stage/cmake.git;a=commitdiff;h=20028d600f643f06a2f4d8a429a02ce770e0c8a4 [^]
(0036031)
Robert Maynard   
2014-06-02 08:37   
Closing resolved issues that have not been updated in more than 4 months.