[CMake] cmake, eclipse cdt, and intellisense

Dan Kegel dank at kegel.com
Thu Dec 15 18:00:28 EST 2011


On Thu, Dec 15, 2011 at 6:57 PM, Dan Kegel <dank at kegel.com> wrote:
> It seems that cmake-2.8.4's generator for eclipse falls short
> when it comes to intellisense (er, content assist).
> While functions that are defined in the same source file are
> handled ok, functions in other files don't seem to be.
>
> Here's a simple example:
>
> $ svn co http://winezeug.googlecode.com/svn/trunk/ winezeug
> $ cd winezeug/cmake_examples/ex7
> $ sh demo.sh
> $ ~/eclipse/eclipse
> Do "File / Import / General / Existing Projects", navigate to
> ~/winezeug/cmake_examples/ex7, and click OK and Finish
> Do "Project / Build All"
> In Project Explorer, open _demo/mymain.c
> In mymain.c, right click on the call to my_function() and select Open
> Declaration
>
> Eclipse then complains "Could not find include file 'mylib.h' on include paths"
>
> I've poked around a bit in eclipse's settings to see if I can force it
> to index everything in the workspace, but haven't found a workaround yet.
> Any suggestions?

To some extent, this is user error.  My demo.sh script added dummy
top-level projects for each source directory because the projects buried
inside Project-Debug at build are so different from what my developers expect.

If I open mymain.c not from the _demo dummy project, but rather from
Project-Debug at build/[Source Directory]/mymain.c, then right-clicking
on "Open Declaration" does find the line of the .h file that declares
the function.

But this doesn't work in our real world app, so I guess I have to find
a better minimal test case.  I did check the project's "C/C++ Include Paths"
property, and the Include Paths property does list all my source directories,
so that's not it.
I guess I'll try to put together a better minimal test case, and use
the latest cmake from git.
- Dan


More information about the CMake mailing list