且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否有一种方法可以使用“swig -MM”生成的依赖关系?

更新时间:2023-02-19 23:19:41

将我的意见转化为答案

我不认为 - 如果你想自动执行,例如想要使用 swig -MM - 这可以在不改变 UseSWIG.cmake 代码。

I don't think - if you want to do this automatically and e.g. want to utilize swig -MM - that this can be done without changing the UseSWIG.cmake code.

我看看为什么以前尝试的链接已被恢复 - 即讨论 0012307:2.8.5 rc2中的回归:UseSWIG.cmake broken - 我不认为 SWIG_GET_WRAPPER_DEPENDENCIES()实际上是破坏了它刚刚介绍了一个新的限制:在调用 SWIG_ADD_MODULE()之前,这只需要swig模块的所有标题才能存在。

When I look at why the previous attempt you have linked was reverted - namely the discussion of on "0012307: regression in 2.8.5 rc2: UseSWIG.cmake broken" - I don't believe that SWIG_GET_WRAPPER_DEPENDENCIES() was actually broken it just introduced a new restriction: "this simply require all headers for swig module to be present" before calling SWIG_ADD_MODULE().

所以我建议添加 -ignoremissing SWIG选项,但这需要进一步测试。

So I suggested to add the -ignoremissing SWIG option, but this would need further testing.

使用CMake版本3.8.0修复自动扫描SWIG文件的Makefile生成器的依赖关系,适用于 makefile 生成器

With CMake version 3.8.0 there came a fix "Automatically scan dependencies of SWIG files for Makefile generators" that works for makefile generators.

关于如何解决这个问题的一般性讨论(包括我的建议)在问题#4147:[MODULES] [UseSWIG]使用swig来计算依赖关系。该票仍然开放(重新开放),所以请随时在那里添加您的支持,建议或测试结果。

The general discussion of how to fix this (including my suggestion) is discussed at "Issue #4147: [MODULES][UseSWIG] Use swig to compute dependencies". The ticket is still open (was reopened), so please feel free to add your support, suggestions or test results there.