[CMake] Fwd: Eclipse generator question

Benjamin Shadwick benshadwick at gmail.com
Wed Apr 3 17:53:59 EDT 2019


Oops, meant to send this to the mailing list, but GMail keeps trying to
divert me.

---------- Forwarded message ---------
From: Benjamin Shadwick <benshadwick at gmail.com>
Date: Wed, Apr 3, 2019 at 2:52 PM
Subject: Re: [CMake] Eclipse generator question
To: Martin Weber <fifteenknots505 at gmail.com>


On Wed, Apr 3, 2019 at 2:18 PM Martin Weber <fifteenknots505 at gmail.com>
wrote:

> Am Mittwoch, 3. April 2019, 22:26:59 CEST schrieb Benjamin Shadwick:
> > I tried cmake4eclipse, and it's a mixed bag. It requires a lot of
> tweaking
>
> Really? Just set _CMake Builder (portable)_ as the current builder and
> build.
>

It required a lot more tweaking than that for an out of source build,
including manually enabling the CMAKE includes and defines providers.


> > of the Eclipse project after you create it, and I'm pretty sure it
> suffers
> > from the same problem of leaving you with an Eclipse project whose source
> > tree reflects what is in the filesystem rather than what is defined in
> the
> > CMake project.
>
> What does that mean: _an Eclipse project whose source tree reflects what
> is in
> the filesystem rather than what is defined in the CMake project._ ??
>

This is exactly what I'm getting at: People have marinated so much in the
way Eclipse works by default that what I'm saying sounds like a non
sequitur.

I'll try to explain:
- I have a repository with a large source tree that contains hundreds of
leaf directories.
- Each leaf directory contains source that needs to be built into a shared
library or an executable binary.
- The source tree contains a superset of the functionality that is needed
by all configurations.
- Any particular configuration of the CMake project will result in only a
subset of the libraries and/or binaries being built.
- The subset being built is defined via CMake option() commands that set
(or don't) cache variables that control which subdirectories are added to
the CMake project.

What I want from Eclipse:
- Only show in the project tree and Open Resource dialog the subset of
source files that belong to the current configuration of the CMake project,
so that developers don't get confused about what is relevant or not to the
configuration of CMake they are working in.
- Only index the subset of source files that belong to the current
configuration of the CMake project, so that resources are not wasted
indexing irrelevant sources, and so that developers are not flooded with
irrelevant indexer errors.
- Show header files that are assigned to a target, including custom
header-only targets ("custom_target(... SOURCES)"), as is done by other
IDEs.


> If the IDE indexing all source files takes too long, I would say it is a
> problem with the IDE; but not a problem of cmake's IDE project generator
> (as
> the topic states).
>

Time is only one aspect (see above), although it's particularly bad with
the out-of-box Eclipse project generated by CMake's default settings
because it indexes every source file 3 times.


> That's the only way to go in your case. How should the CDT4 project
> generator
> know about all your source files that do not take part in a build?
>

The point I'm trying to make is that I *don't* want Eclipse to know about
source files that are *not* being built, but it *does* know about them
because all solutions (CMake generator, cmake4eclipse) just point Eclipse
at the source tree *in the filesystem*, and not at the conceptual project
tree defined via the CMakeLists.txt hierarchy. Remember that for me, the
filesystem contains lots of sources that are *not* relevant to any one
CMake configuration that developers will be working with.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190403/2065746d/attachment.html>


More information about the CMake mailing list