cmake,add_subdirectory而不将其添加到生成的项目文件中?
我有一个使用 cmake 构建的项目。在我的 cmakelists 中我有一个 add_subdirectory(externals/foo)
构建具有自己的 cmakelists 的依赖项“foo”。
现在,整个 foo 源代码和标头也包含在生成的项目文件中(我使用的是 Eclipse)。但我想要的只是让我的项目在 Eclipse 中可用(Eclipse 在同一文件夹结构中存在子项目问题)。 因此,“foo”中的 cmakelists 仅用于自动构建“foo”并将其链接到我的项目。但我不想在我的 IDE 中看到它。
这可能吗?如果是:如何?
I have a project that is build with cmake. In my cmakelists I have aadd_subdirectory(externals/foo)
to build the dependency "foo" which has it's own cmakelists.
Now it is so that also the whole foo sources and headers are included in the generated Project file (I'm using Eclipse). But all I want is to only have my project available in Eclipse (Eclipse has problems with subprojects in the same folder structure).
So that the cmakelists from "foo" is only used to build "foo" automatically and link it to my project. I don't want to see it in my IDE however.
Is this possible? If yes: How?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
当我将 Eclipse 与 CMake 结合使用时,我手动创建 Eclipse 项目(使用“新建项目”向导),对于 CMake,我使用标准 makefile 生成器。它需要一些额外的设置:如果您正在进行源外构建,则需要在项目属性中设置构建目录,我通常将构建命令设置为
make VERBOSE=1
。我不确定,因为我没有使用过 Eclipse 生成器,但由于缺乏更好的解决方案,也许这种方法可以解决您的问题,因为它使您可以更好地控制 Eclipse 项目。
When I use Eclipse with CMake, I create the Eclipse project manually (with the New Project wizard) and for CMake I use the standard makefile generator. It requires a little extra setup: you need to set the build directory in the project properties if you're doing an out-of-source build, and I usually set the build command to
make VERBOSE=1
.I'm not sure since I haven't used the Eclipse generator(s), but for the lack of a better solution, perhaps this method would solve your issue, since it gives you more control over the Eclipse project.