[CMake] Cmake(3.0.2) Eclipse project indexing issues under linux

Alexander Neundorf a.neundorf-work at gmx.net
Mon Oct 6 16:51:20 EDT 2014


Hi,

thanks for your detailled findings.
Can you please create a ticket in the bug tracker with this, so it doesn't get 
lost ?
http://public.kitware.com/Bug

Thanks
Alex

On Monday, October 06, 2014 14:30:06 Tushar Soni wrote:
> 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.tx*t -> 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!



More information about the CMake mailing list