Eclipse CDT、cmake、重叠子项目
我有一个 CMakeLists.txt,用于为我的项目生成 Eclipse CDT 项目文件。现在,我向我的项目添加了一个依赖项,该项目有自己的 CMakeLists.txt。在我自己的列表文件中,我添加了 add_subdirectory("/myDep" EXCLUDE_FROM_ALL)
和 target_link_libraries(myApp myDep)
。
问题是 Eclipse 抱怨子项目 myDep 与工作区重叠,因为它位于同一工作区中。结果我无法导入 Eclipse CDT 项目文件(因此我无法处理我的程序)。
现在问问题: 使用 cmake 和 Eclipse CDT 将源依赖项添加到我的项目的正确方法是什么?该项目应该与我的应用程序一起编译,然后链接到我的应用程序,并且是我的项目的子文件夹?
I have a CMakeLists.txt that I use to generate Eclipse CDT project files for my project. Now I added a dependencie to my project that has its own CMakeLists.txt. In my own list file I added add_subdirectory("/myDep" EXCLUDE_FROM_ALL)
and target_link_libraries(myApp myDep)
.
Problem is that Eclipse complains that the subproject myDep is overlapping with the workspace because it's in the same workspace. With the result that I can't import the Eclipse CDT project file (and so I can't work on my program).
Now for the question:
What's the correct way with cmake and Eclipse CDT of adding a source dependency to my project that should be compiled along with my app and then linked to my app and is a subfolder from my project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也看到过这个错误消息。似乎在较新版本的 CMake 中(例如在版本 2.8.7-rc1 中:“Eclipse:如果 CMAKE_BINARY_DIR 是 CMAKE_SOURCE_DIR 的子目录则发出警告”[1]),Eclipse 项目生成器有许多改进。希望这可以改善同时使用 Eclipse 和 CMake 时的情况。
[1] http://www.kitware.com/blog/home/post/208< /a>
I have seen this error message too. It seems that in newer versions of CMake (e.g. in version 2.8.7-rc1: "Eclipse: warn if CMAKE_BINARY_DIR is subdir of CMAKE_SOURCE_DIR" [1]) there are many improvements to the Eclipse project generator. Hopefully that improves the situation when using Eclipse and CMake together.
[1] http://www.kitware.com/blog/home/post/208