Eclipse CDT, cmake, overlapping subproject
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?
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
精彩评论