MantisBT - CMake
View Issue Details
0012417CMakeCMakepublic2011-08-24 04:512011-12-16 17:16
Simon Barner 
Alex Neundorf 
normalminoralways
closedfixed 
x86Windows7
CMake 2.8.5 
CMake 2.8.7CMake 2.8.7 
0012417: CDT4 generator: source path configured incorrectly
I use CMake 2.8.5 to generate Eclipse CDT4 projects (Eclipse Helios SR2
for C/C++ developers, CDT with mingw makefiles).

Since 2.8.5, for each project that is added using add_subdirectory(), a
linked resource is created which enables me to easily navigate to files
of subprojects.

However, the source path for my linked subproject seems to be incorrect
since I get the following warnings (see below for a test case).

  Invalid project path: Missing project folder or file \test@build\test
  for source path


  Invalid project path: Missing project folder or file \test@build\sub
  for source path

Unfortunately, this seems to prevent the Eclipse indexer from correctly
picking up the files in my subprojects.

I had a look at the generated .cproject, and here the following path
entries are generated:

<pathentry kind="src" path="[Source directory]"/>
<pathentry kind="src" path="/sub"/>
<pathentry kind="src" path="/test"/>

When I manually modify the generated .cproject file to match the actual
virtual folders the warnings go away and the index works correctly:

<pathentry kind="src" path="[Source directory]"/>
<pathentry kind="src" path="[Subprojects]/sub"/>
<pathentry kind="src" path="[Subprojects]/test"/>

Please note, it also possible to simply add the virtual [Subprojects]
folders as a path entry:

<pathentry kind="src" path="[Source directory]"/>
<pathentry kind="src" path="[Subprojects]"/>
Here is my test case (see also attachment)

Directory layout:
project
project/test/CMakeLists.txt
project/test/sub/CMakeLists.txt
project/build

project/test/CMakeLists.txt:
--
project(test)
add_subdirectory(test)
--

project/test/sub/CMakeLists.txt:
--
project(sub)
--

I configured an out-of-source build to project/build which I imported
into Eclipse.
No tags attached.
related to 0012213closed Alex Neundorf Eclipse CDT4 Generator: Incompleted <linkedResources> 
related to 0012223closed Alex Neundorf Support of linked resources in Eclipse/CDT (single files, not folders) 
related to 0012479closed Alex Neundorf Generated Eclipse CDT files only valid for >= Helios (3.6) 
zip testcase-CDT4.zip (5,156) 2011-08-24 04:51
https://public.kitware.com/Bug/file/4016/testcase-CDT4.zip
Issue History
2011-08-24 04:51Simon BarnerNew Issue
2011-08-24 04:51Simon BarnerFile Added: testcase-CDT4.zip
2011-08-24 11:55Alex NeundorfAssigned To => Alex Neundorf
2011-08-24 11:55Alex NeundorfStatusnew => assigned
2011-09-30 14:53Alex NeundorfRelationship addedrelated to 0012213
2011-09-30 14:54Alex NeundorfRelationship addedrelated to 0012223
2011-09-30 15:17Alex NeundorfRelationship addedrelated to 0012479
2011-10-04 16:16Alex NeundorfNote Added: 0027523
2011-10-05 15:55Simon BarnerNote Added: 0027528
2011-10-05 16:00Alex NeundorfNote Added: 0027530
2011-10-23 09:05Alex NeundorfNote Added: 0027626
2011-10-23 09:05Alex NeundorfStatusassigned => closed
2011-10-23 09:05Alex NeundorfResolutionopen => fixed
2011-12-16 17:16David ColeFixed in Version => CMake 2.8.7
2011-12-16 17:16David ColeTarget Version => CMake 2.8.7

Notes
(0027523)
Alex Neundorf   
2011-10-04 16:16   
Are these source directories also include directories for your project ?
I had the impression that having a directory in the list of include directories is enough to make the parsing in Eclipse work, at least Eclipse shows me the member functions when autocompleting.

What exactly doesn't work for you (except the warning message) ?

Alex
(0027528)
Simon Barner   
2011-10-05 15:55   
I just re-checked, and the index works now also when the warnings about the linked resources still exist in the project. However, I have to build the project first, but AFAIK this is expected.

Anyways, it would be nice to see this fixed, e.g. by implementing my suggestion from the bottom of me initial post (unless I overlooked issues with this solution):

<pathentry kind="src" path="[Source directory]"/>
<pathentry kind="src" path="[Subprojects]"/>

So, after triggering a rebuild of my project, the only remaining problem is the warning messages.
(0027530)
Alex Neundorf   
2011-10-05 16:00   
I wasn't the one who wrote this generator initially, so I actually don't know what the "src" pathentries are good for exactly.
I also didn't find information about the .cproject file format, also the API docs for CDT plugins are quite terse. I asked on the cdt mailing list in the meantime.

Or do you maybe know more details about the file format ?

My plan is to try to fix all Eclipse-related bugs for the next cmake release.

Alex
(0027626)
Alex Neundorf   
2011-10-23 09:05   
I kind of fixed this, it is now in the "next" branch of cmake.
It would be nice if you could give it a try and let me know whether you notice any (new) problems.

The generator now actually does not generate src-pathentries anymore at all, and I didn't find anything which is not working anymore.

Alex