[CMake] Eclipse CDT4 CMake Generator - Pre-Alpha version
Miguel A. Figueroa-Villanueva
miguelf at ieee.org
Tue Jul 31 15:40:04 EDT 2007
On 7/31/07, Alexander Neundorf <a.neundorf-work at gmx.net> wrote:
> Hi Miguel,
>
> On Tuesday 31 July 2007 13:42, Miguel A. Figueroa-Villanueva wrote:
> > On 7/31/07, Alexander Neundorf wrote:
> > > On Tuesday 31 July 2007 09:51, you wrote:
> > > ...
> > >
> > > > Great! If you personally think this is good and can review/apply the
> > > > patches relatively quickly then that will work well for me. What I was
> > > > worried about was that I open a feature request and, understandably
> > > > so, it sits there to be taken care according to everyone's busy
> > > > schedule...
> > > >
> > > > I sent the patch to the list last night, but it rejected the e-mail
> > > > because it was too big... I'll now clean up the code according to the
> > > > coding style and resend with cc to you. This time tared and zipped, so
> > > > it shouldn't have a problem.
> > >
> > > Thanks :-)
> >
> > Attached is the file. I changed some variable names and other minor
> > things, but I'm not certain it follows all the coding standards. I
> > leave that to your inspection, although please point out whatever you
> > find that you needed to fix for my future reference.
>
> It looks quite good :-)
>
> The indentation is not completely correct:
>
> if (!fout) { return; }
>
> if(emmited.find(t->first) == emmited.end())
> {
> emmited.insert(t->first);
> this->AppendTarget(fout, t->first);
> }
>
> should be (indented braces)
>
> if (!fout)
> {
> return;
> }
>
> if(emmited.find(t->first) == emmited.end())
> {
> emmited.insert(t->first);
> this->AppendTarget(fout, t->first);
> }
Noted, thanks.
> How do you handle the cmake projects ? You iterate over the map, which effect
> does this have ?
Well, since I want to create the .project/.cproject in the
CMAKE_BINARY_DIR what I did was that I created a linked resource to
the source directory in the .project file. That way the paths to the
project sources are in the "Project Explorer" and "Navigator" windows.
I also iterate over the map during the .cproject creation to tag these
linked resources as source directories. I believe this is important
for indexing, but I'm not sure if it is completely ironed out.
I also list all the targets to the "Make" window, so that the user can
click the target and make it.
> From the header:
> enum ToolChainType { OTHER, LINUX, CYGWIN, MINGW, SOLARIS, MACOSX };
> I would prefer more specific names, e.g. prefixing them
> with "EclipseToolchain", so that you have EclipseToolchainCygwin etc.
Even if it is a private enum? Ok, I guess the following should do, right?
enum EclipseToolchainType {
EclipseToolchainOther,
EclipseToolchainLinux,
EclipseToolchainCygwin,
EclipseToolchainMinGW,
EclipseToolchainSolaris,
EclipseToolchainMacOSX
};
> One thing which would be nice is if you would also put the include directories
> in the project files, I think this is required for autocompletion. You can
> get them via cmMakefile::GetIncludeDirectories().
I thought about that and I'll do it, but the reason I hesitated was
because I don't know how to add them in a per cmake project basis. I
can include it in the toplevel (and only) .cproject, but that applies
to all projects beneath it, which isn't much of a problem since your
building with "make" anyhow.
As far as I know however, eclipse cdt doesn't support nesting
.project/.cproject for hierarchichal project structures. Does any one
know more about this? I'm planning on asking these on the cdt list
eventually.
> Do you already setup up running and debugging ?
> I don't know how this works with Eclipse, for KDevelop I put the first
> executable target I found in the entry where it expects the executable to be
> debugged.
I don't; Eclipse does it for me. It finds the binaries and libraries.
I setup a run/debug profile if I want to pass arguments to the
executable, but I didn't detect any changes to the .project/.cproject.
But I can select the binary and hit run out-of-the-box.
> Can you tell Eclipse to open a file when the project is loaded the first
> time ? Looks much friendlier then. If this is possible, just use the first
> source file or the first main.* file you find.
I'm lost here... Oh, you mean just so it doesn't open with a blank editor?
Well, I don't know if this is possible. First, Eclipse remembers what
I was last editing so no problem the second time around. Second, I
don't double-click the project file created by cmake to open eclipse.
I open eclipse, then I have to "import" the "Existing Eclipse Project"
to my workspace. That is done once then eclipse remembers, of course.
> For the KDevelop generator I implemented a simple logic which reads the
> project files it created on a previous cmake run (and which may have been
> modified in the meantime by kdevelop) and just modifies what it needs to
> change, so user changes (like which plugins to load, source control config
> etc.) stay unchanged.
I'll look into this later on. But I have to warn you that eclipse has
this notion of the workspace. I guess somethings like doing "Full/Fast
Indexing", editor preferences, projects loaded, etc. stay configured
in the workspace. And have nothing to do with the project files. I
guess that is where run/debug profiles are kept also.
But hey, I'm not sure how any of this works ;) What I'm doing is I
copy the .project/.cproject files before loading and I monitor their
changes. When I get more feedback I might implement fancier things to
enable better integration.
Hope this clarifies a few things and thanks for the pointers, Alex.
--Miguel
More information about the CMake
mailing list