[cmake-developers] UseSWIG warns about CMP0057

Brad King brad.king at kitware.com
Fri Mar 27 08:34:42 EDT 2015


On 03/26/2015 05:16 PM, felix schwitzer wrote:
> Is this a bug in UseSWIG or is my use case invalid?

It's a bug exposed by the policy warning.  We never supported repeated
use of MAIN_DEPENDENCY, it just wasn't diagnosed before CMP0057.

> The warning comes from UseSWIG in line 193; the interface file is added as
> a MAIN_DEPENDENCY to the swig-generated wrapper file, and because of the loop,
> it is added twice, to the lttPYTHON_warp.cxx and lttRUBY_warp.cxx,
> the two swig-generated files.
> 
> Fixing this would be simple by adding the interface file as a normal dependency
> to the wrapper-files, the only drawback is backward compatibility.

Yes, it should be fixed to just use DEPENDS instead of MAIN_DEPENDENCY,
at least if there are multiple languages to be generated.  There is no
compatibility issue because MAIN_DEPENDENCY only affects the presentation
of source files in IDE projects.  Otherwise it is the same as DEPENDS.
This is likely why repeated MAIN_DEPENDENCY didn't get noticed before.

I'm not set up to test UseSWIG on a real project like you.  Would you
please look at making and testing the change locally and then send
a patch?

Thanks,
-Brad



More information about the cmake-developers mailing list