[cmake-developers] Better Eclipse CDT support

Alexander Neundorf neundorf at kde.org
Tue Apr 19 14:58:30 EDT 2011


Hi Oliver,

On Sunday 17 April 2011, Oliver Buchtala wrote:
> Hi Alex,
>
> Am 17.04.2011 20:46, schrieb Alexander Neundorf:
> > Hi,
> >
> > On Sunday 17 April 2011, Oliver Buchtala wrote:
> >> Hi,
> >>
> >> I like to get involved offering work on the Eclipse CDT generator.
> >>
> >> Currently, the generated project setting is not very Eclipse'ish.
> >
> > There have been some changes in the 2.8.x versions. You have 2.8.4 ?
>
> Yes. Actually current 'next' of stage.
>
> >>  - one large project
> >>  - linear build, i.e., build failure in early sub projects stops the
> >> whole chain
> >
> > You can change this e.g. by adding "-k" as CMAKE_ECLIPSE_MAKE_ARGUMENTS
> > in the cmake cache.
>
> What does '-k' do?

Continue building other targets if some targets failed.

> >>  - project overview looks like navigator on  cmake binary directory
> >>  - source files can be found in 'includes'
> >
> > Can you please explain the two points above in more detail ?
>
> When I generate a CDT project, sources are in 'includes' (CDT built-in

I guess there is a 
include_directories(${CMAKE_SOURCE_DIR})
or something similar in the project, so this directory appears 
under "Includes".

> folder). The rest is the content of CMAKE_BINARY_DIR.

Yes, plus the links to the sub projects.
What would you expect there ?

Is your build dir a subdir of the source dir ?
In this case the link to CMAKE_SOURCE_DIR is not generated, otherwise there 
should be a link [Source directory].
It's a pity that Eclipse has such problems with out-of-source builds.
It's really Eclipse which would need some fixing here.
It would just have to accept that the base source directory is not always the 
directory where the project file is located, but can be a directory specified 
in the project file.
This would help a lot.

> See attachment: 2.4.8 CDT4 MinGW generator on CMake/Example, Eclipse
> Helios, CDT 7.0.2
>
> >> All in all, this is not what a developer used to CDT wants to see ;)
> >>
> >> What I want to do:
> >>  - generate projects for each target (like in VC generators)
> >
> > Can you please explain ?
> > Do you want a separate build tree for each project ?
> > Or just separate Eclipse project files for each target ?
>
> For each target. Like in MSVC.
>
> > Are you sure people will want to import that many projects or can they be
> > grouped in some way in a "superproject" ?
>
> Eclipse users are used to a flat multi-project layout. They use working
> sets to group projects.
> Actually, I am personally not the greatest friend of complete flat
> hierarchies - but this is actually the eclipse way.
> You may have a look at large Eclipse java projects, e.g. Eclipse itself.
> Importing all projects in a directory is a one-clicker. Though, they
> should not be nested for that feature to work.

Hmm.
So this would be one build tree (i.e. one CMakeCache.txt with a global 
Makefile-structure), and Eclipse-projects for each target, and a "working 
set" which groups these projects together ?

Don't know. Maybe.
Can you provide a screenshot of how this looks like ?
Or maybe create a clone of the cmake git tree on gitorious or github and try 
to implement it there ?

Or, how about instead of creating one project per target one project per 
project() call ?

...
> >> Q's:
> >> - What is your opinion?
> >
> > A not-Makefile based "native" Eclipse project generator might also be an
> > alternative, but requires more work.
>
> I think the Makefile based approach is very reasonable as it is really
> tightly integrated.
>
> Actually, there is not too much missing IMO.
> Per target project would bring a more intuitive relation between targets
> and projects.
> This is really what I want from the IDE setting. Otherwise I will use
> make on the shell.
>
> I would add a project per target based on make. Per project add only the
> one make target.
> And maybe add a global ALL project. Maybe also a ZERO_CHECK project all
> others depend on ... for checking on CMakeLists.txt changes.
>
>
> Another question: you call the generator CDT4. Current CDT is 7.0.2.

This is because it was 4.0 when the generator was started.
The name simply was not changed since then.

Alex



More information about the cmake-developers mailing list