[cmake-developers] [CMake 0015347]: Eclipse indexing no longer works

Mantis Bug Tracker mantis at public.kitware.com
Tue Jan 13 11:10:12 EST 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15347 
====================================================================== 
Reported By:                Christopher Buxenstein
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15347
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-01-13 11:10 EST
Last Modified:              2015-01-13 11:10 EST
====================================================================== 
Summary:                    Eclipse indexing no longer works
Description: 
We are experiencing the same issue reported by another user (Tushar Soni) at
http://cmake.3232098.n2.nabble.com/Cmake-3-0-2-Eclipse-project-indexing-issues-under-linux-td7588680.html.
 Since I don't see their issue reported here, I am copying their response here
so it is tracked.

The issue is that Eclipse is only indexing the contents of [Source directory]
and does not include subprojects.



[Tushar Soni's original message]
Hi,

After generating Eclipse projects and importing them, Eclipse is not indexing
all source files. I have detailed the issue (so sorry for the long email) and
the experiments I have performed to resolve the issue. I would be really glad if
someone could point out, what is going wrong or is there some bug?

Not to go in too much details, here is how my directory (project) structure
looks like in order to explain the issue in more details:

Sources: 

$someDir/common/project_a/src/source_a.cpp
$someDir/common/project_a/CMakeLists.txt -> Project A is a common lib, uses by
many tests

$someDir/tests/test_a/src/test_a.cpp
$someDir/tests/test_a/CMakeLists.txt -> Includes the Project A using
add_subdirectory and creates a share object

Cmake build directories:
$someDir/cmakeOut/common/project_a/
$someDir/cmakeOut/tests/test_a/

Cmake generated everything without errors and building the project using make or
Eclipse was not an issue. The issue is only when I import the project in Eclipse
(version 4.3.2) by Import -> General -> Existing Project ->
$someDir/cmakeOut/tests/test_a/, the indexer does not seem to be working
properly. It only indexes one source (test_a.cpp) whereas it should index two
(test_a.cpp + sourc_a.cpp).

this is just an example setup, in my actual project, only 1 source file gets
indexed out of the 142 it should do. therefore it makes using Eclipse very hard!

Now this is what I noticed with my experiments.

Experiment 1: Change cmake version and compare

I used the exact same files and folder structure but changed the cmake version
to 2.8.10.2. The generated Eclipse project was able to index both the source
files! This was mind boggling. I have to use the cmake 3.0.2 version, so I tried
to narrow down the issue. 

When I did the diff of the .cproject created by the two cmake version I saw
this:

cmake 3.0.2 has this in the .cproject

<pathentry kind="src" path="[Source directory]"/>
<pathentry excluding="[Source directory]/|**/CMakeFiles/" kind="out" path=""/>

cmake 2.8.10.2 has this in the .cproject

<pathentry excluding="**/CMakeFiles/" kind="out" path=""/>

The rest of the file is similar (except cmake path, which is obvious).

Success Result: If I delete the line <pathentry kind="src" path="[Source
directory]"/> from the .cproject and then import the project, indexing seems to
be working!!! however I cant use this solution as my project is not checked in
and every body using it needs to make this step manually.

Experiment 2: Change the import method

After a lot of googling I found out that someone was suggesting to import the
project using this method (BTW, for totally different problem): Import -> C/C++
-> Existing Code as Makefile Project -> $someDir/cmakeOut/tests/test_a/ . When I
did this, it again works! Mind boggling yet again!

Just by chance I found out that this method works because, by importing this way
Eclipse somehow modifies the .cproject and removed the lines like I did in first
experiment. 

Conclusion: So based on my experiments this line in the .cproject is causing an
issue with indexing:
<pathentry kind="src" path="[Source directory]"/>

I know most likely my conclusion is not correct but I do not have any other
explanation. Also I do not know why this line is actually the issue! Therfore I
am writing to you all to understand the issue a bit better. Maybe the issue is
elsewhere.

Thanks in advance!
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-01-13 11:10 Christopher BuxensteinNew Issue                                
   
======================================================================



More information about the cmake-developers mailing list