<div dir="ltr"><div><div>Update - I think I found a tolerable workaround:</div><div><br></div><div>If I invoke cmake with -DCMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES=OFF and then inject a link to my include directory into the .project file, things work a lot better:</div><div>- I get only one copy of each source file in the Open Resource dialog.</div><div>- I get source and header files in the Open Resource dialog.</div><div>- I can toggle between source and header.<br></div><div>- I can build from Eclipse.</div><div>- I get version control support, even in my include tree.</div><div>- Indexing is fast.<br></div><div><br></div><div>It seems that Eclipse improved version control support quite a bit since the CMake Eclipse generator was last touched. Unfortunately this seems to also mean that a lot of the linked resources that CMake generates by default now just add noise (hence my better results from turning them off).<br></div><div><br></div><div>There are still some aspects that are not ideal. In particular, CMake brings the source files into the project via the "[Source directory]" virtual folder, which just points to the CMake project root directory on the filesystem. This approach has a number of issues:</div><div>- Source files that are not part of the CMake project show up in Open Resource and possibly the Eclipse CDT index.</div></div><div>- A view of the sources/headers belonging to each CMake target is not really provided (although you can glean the sources part somewhat by looking at the detailed target tree).</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 2, 2019 at 9:04 AM Benjamin Shadwick <<a href="mailto:benshadwick@gmail.com">benshadwick@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I've recently converted a complex C++ codebase to CMake. I'm stuck using 2.8.12.2.</div><div><br></div><div>The codebase has a source tree, whose leaf directories each build a shared library or an executable binary. The source lives in src/ while the headers live in a separate tree under a sibling include/ directory.</div><div><br></div><div>Based on advice from the Internet, I am trying to do out-of-source builds, with the debug flavor in a debug/ sibling directory, and release in release/</div><div><br></div><div>This all works from the command line, but I am using Eclipse CDT as my primary IDE and would like to get decent integration between that and CMake.</div><div><br></div><div>When I use CMake's Eclipse generator and then import the project into Eclipse, there are some serious issues. The primary issue is that when I hit Ctrl+Shift+R to bring up the Open Resource dialog and then type in the name of a source file, I get 3 results: one under each of [Source files],
[Subprojects], and [Targets]. This is awful, especially since picking the wrong one results in weird behavior like inability to resolve include directives or inability to toggle between source and corresponding header file.</div><div><br></div><div>Is there some way to address this without resulting to in-source builds? I'm even willing to butcher the project files post-generate using Python if it would help.</div><div><br></div><div>Thanks,</div><div>- Ben S.<br></div></div>
</blockquote></div>