Re: [CMake] Eclipse generator question

2019-04-05 Thread Martin Weber
Am Freitag, 5. April 2019, 00:07:08 CEST schrieb Benjamin Shadwick:
> Ah, it seems my CMake is too old to produce compile_commands.json. Maybe
> this is part of why other IDEs are working better at home on Ubuntu MATE
> LTS.
> 
> Unfortunately Red Hat ships CMake 2.8.12.2 even in recent RHEL releases,
> which is now approaching 5 years old (yikes!). Apparently they ship CMake
> 3.13.4 as a 'cmake3' package and I didn't catch it - will see if I can
> upgrade at least some of my machines.

They don't! Maybe you find a more recent RPM at https://build.opensuse.org/
 and ask the package maintainer there to also build it for RHEL.
I took the same approach on our company-internal OBS.


-- 
Cd wrttn wtht vwls s mch trsr.




-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Eclipse generator question

2019-04-04 Thread Benjamin Shadwick
Ah, it seems my CMake is too old to produce compile_commands.json. Maybe
this is part of why other IDEs are working better at home on Ubuntu MATE
LTS.

Unfortunately Red Hat ships CMake 2.8.12.2 even in recent RHEL releases,
which is now approaching 5 years old (yikes!). Apparently they ship CMake
3.13.4 as a 'cmake3' package and I didn't catch it - will see if I can
upgrade at least some of my machines.

On Thu, Apr 4, 2019 at 2:07 PM Martin Weber 
wrote:

> Am Mittwoch, 3. April 2019, 23:52:38 CEST schrieben Sie:
> > On Wed, Apr 3, 2019 at 2:18 PM Martin Weber 
> >
> > 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,
>
> cmake4eclipse enforces out of source build by default, with the build
> directory below project root.
>
> > including manually enabling the CMAKE includes and defines providers.
>
> cmake4eclipse is not a tool to configure your project. Aside from that,
> the
> CDT API does not allow to fully configure a project programatically.
>
> >
> > > > 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.
>
> Well, that's CDT. If you press 'Apply and Close' in the project property
> dialog, if write the file 2 times to disk :-[
>
> >
> > > 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
>
> OK, I see your point. CDT indeed has no concept of 'conceptual project
> tree'
> as you name it.
> But it has filters for files in the source tree! And these seem to operate
> on
> a per-configuration-base.
> And cmake4eclipse already has a parser for the compile_commands.json file
> produces by cmake. That file lists each file in the build.
>
> My idea to ease your problem is to have a menu action in the UI that
> configures the source file filter of the project based on the files listed
> in
> the compile_commands.json file.
> ...
> > - Any particular configuration of the 

Re: [CMake] Eclipse generator question

2019-04-03 Thread Benjamin Shadwick
On Wed, Apr 3, 2019 at 2:50 PM Martin Weber 
wrote:

> To implement the 'index only files referenced through the build script'
> view,
> *any* IDE would have to *interpret* the build scripts.
> Just choose an IDE that has a build script interpreter to solve your use
> case.
>
Qt Creator and Visual Studio Code (with the appropriate plugins installed)
seem to be able to do this. I now use them at home in preference over
Eclipse CDT because of this, but Eclipse CDT is currently the path of least
resistance at work.


> > cmake4eclipse are taking advantage of what modern Eclipse versions can
> do.
>
> Sounds promising. What is it that _modern Eclipse versions can do_?
>

It looks like you can compose the Eclipse project tree to look any way you
want via use of linked resources. Apparently when doing this in older
versions of Eclipse, it would break its version control integration. This
no longer seems to be the case.

When using the CMake Eclipse project generator via its default settings, I
get a "[Targets]" virtual directory in the Eclipse project that actually
shows the source files under their respective targets, in a structure that
is closer to that defined in the CMake project than what is on the
filesystem. Unfortunately it also generates a bunch of *other* garbage to
make things work in older Eclipse releases that just create a bunch of
noise in new releases that make the project almost unusable for anything
but building.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Eclipse generator question

2019-04-03 Thread Martin Weber
Am Mittwoch, 3. April 2019, 22:55:45 CEST schrieb Benjamin Shadwick:
> FYI,
> 
> I opened a bug on CMake's tracker about updating the CMake generator since
> its outputs are kind of garbage for modern CDT releases:
> https://gitlab.kitware.com/cmake/cmake/issues/19107
> 
> Unfortunately the only feedback I got was that there is a push to remove
> *all* generators in favor of forcing IDEs to use cmake-file-api. I opened a

+1 from me for removing IDE project generators.

[...]
> Maybe being tied to the filesystem view is an inherent limitation of
> Eclipse (and/or CDT), or maybe it was at one time and neither CMake nor

To implement the 'index only files referenced through the build script' view, 
*any* IDE would have to *interpret* the build scripts. 
Just choose an IDE that has a build script interpreter to solve your use case.

> cmake4eclipse are taking advantage of what modern Eclipse versions can do.

Sounds promising. What is it that _modern Eclipse versions can do_?

-- 
Cd wrttn wtht vwls s mch trsr.




-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Eclipse generator question

2019-04-03 Thread Martin Weber
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.

> 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._ ??

 
> It's really annoying that I spent all this time building a CMake project
> for a complex codebase, only to have the IDE present and index the entire
> source tree on the filesystem instead of the subset that is actually being
> built by the CMake configuration.

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).

> I should probably enhance my project-tweaking python script to add filters
> to the generated Eclipse project to hide anything that isn't in the CMake
> project.

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?



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Eclipse generator question

2019-04-03 Thread Benjamin Shadwick
FYI,

I opened a bug on CMake's tracker about updating the CMake generator since
its outputs are kind of garbage for modern CDT releases:
https://gitlab.kitware.com/cmake/cmake/issues/19107

Unfortunately the only feedback I got was that there is a push to remove
*all* generators in favor of forcing IDEs to use cmake-file-api. I opened a
bug on the Eclipse tracker asking if they knew about this push and whether
anyone was working on it from the CDT end, and they aren't but are
receptive: https://bugs.eclipse.org/bugs/show_bug.cgi?id=545905

None of that helps me, though, because I'm stuck on CMake 2.8.12.2 for now.

I think my main philosophical issue is that CMake lets you define a
project, and I'd like to see that definition reflected in Eclipse.
Unfortunately, both the CMake Eclipse generator and cmake4eclipse plugin
leave you with a filesystem-oriented view of the source instead of a CMake
project oriented view. You can get most of this from importing a CMake
project into something more primitive like NetBeans.

Maybe being tied to the filesystem view is an inherent limitation of
Eclipse (and/or CDT), or maybe it was at one time and neither CMake nor
cmake4eclipse are taking advantage of what modern Eclipse versions can do.

On Wed, Apr 3, 2019 at 1:32 PM Martin Weber 
wrote:

> Am Mittwoch, 3. April 2019, 18:44:04 CEST schrieb Benjamin Shadwick:
> > Update - I think I found a tolerable workaround:
> >
> > 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:
>
> You (and other having problems with eclipse projects generated by cmake)
> might
> want to read these posts of the CDT project lead concerning cmake's CDT4
> generator [1] [2].
>
> Martin
>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=530090#c3
> [2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=530090#c5
>
>
> --
> Cd wrttn wtht vwls s mch trsr.
>
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Eclipse generator question

2019-04-03 Thread Martin Weber
Am Mittwoch, 3. April 2019, 18:44:04 CEST schrieb Benjamin Shadwick:
> Update - I think I found a tolerable workaround:
> 
> 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:

You (and other having problems with eclipse projects generated by cmake) might 
want to read these posts of the CDT project lead concerning cmake's CDT4 
generator [1] [2].

Martin

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=530090#c3
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=530090#c5


-- 
Cd wrttn wtht vwls s mch trsr.




-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Eclipse generator question

2019-04-03 Thread Benjamin Shadwick
I tried cmake4eclipse, and it's a mixed bag. It requires a lot of tweaking
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.

It's really annoying that I spent all this time building a CMake project
for a complex codebase, only to have the IDE present and index the entire
source tree on the filesystem instead of the subset that is actually being
built by the CMake configuration.

I should probably enhance my project-tweaking python script to add filters
to the generated Eclipse project to hide anything that isn't in the CMake
project.

On Wed, Apr 3, 2019 at 1:02 PM Martin Weber 
wrote:

> Am Mittwoch, 3. April 2019, 18:44:04 CEST schrieb Benjamin Shadwick:
> > Update - I think I found a tolerable workaround:
> >
> > 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:
> > - I get only one copy of each source file in the Open Resource dialog.
> > - I get source and header files in the Open Resource dialog.
> > - I can toggle between source and header.
> > - I can build from Eclipse.
> > - I get version control support, even in my include tree.
> > - Indexing is fast.
> >
> > 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).
>
> Newer versions of CDT (9.1+) seem to have trouble to properly read the
> .cproject file generated by cmake [1] [2].
>
> Forget about running cmake manually and install _cmake4eclipse_ from the
> eclipse marketplace. It runs cmake automatically [3] and comes with
> support
> for the eclipse indexer. Some people even use it for CUDA in the nvidia
> insight IDE. (Disclaimer: I am the maintainer)
> Just try it with one of the example projects [4].
>
> Martin
>
> [1] 
> [2]  

Re: [CMake] Eclipse generator question

2019-04-03 Thread Martin Weber
Am Mittwoch, 3. April 2019, 18:44:04 CEST schrieb Benjamin Shadwick:
> Update - I think I found a tolerable workaround:
> 
> 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:
> - I get only one copy of each source file in the Open Resource dialog.
> - I get source and header files in the Open Resource dialog.
> - I can toggle between source and header.
> - I can build from Eclipse.
> - I get version control support, even in my include tree.
> - Indexing is fast.
> 
> 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).

Newer versions of CDT (9.1+) seem to have trouble to properly read the 
.cproject file generated by cmake [1] [2]. 

Forget about running cmake manually and install _cmake4eclipse_ from the 
eclipse marketplace. It runs cmake automatically [3] and comes with support 
for the eclipse indexer. Some people even use it for CUDA in the nvidia 
insight IDE. (Disclaimer: I am the maintainer)
Just try it with one of the example projects [4].

Martin

[1] 
[2] 

Re: [CMake] Eclipse generator question

2019-04-03 Thread Benjamin Shadwick
Update - I think I found a tolerable workaround:

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:
- I get only one copy of each source file in the Open Resource dialog.
- I get source and header files in the Open Resource dialog.
- I can toggle between source and header.
- I can build from Eclipse.
- I get version control support, even in my include tree.
- Indexing is fast.

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).

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:
- Source files that are not part of the CMake project show up in Open
Resource and possibly the Eclipse CDT index.
- 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).

On Tue, Apr 2, 2019 at 9:04 AM Benjamin Shadwick 
wrote:

> I've recently converted a complex C++ codebase to CMake. I'm stuck using
> 2.8.12.2.
>
> 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.
>
> 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/
>
> 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.
>
> 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.
>
> 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.
>
> Thanks,
> - Ben S.
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake