View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015347 | CMake | CMake | public | 2015-01-13 11:10 | 2016-06-10 14:31 | ||||
Reporter | Christopher Buxenstein | ||||||||
Assigned To | Alex Neundorf | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | Ubuntu 12.04 (32 bit) | OS | Linux | OS Version | 3.2.0 | ||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015347: 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! | ||||||||
Tags | CMake, Eclipse | ||||||||
Attached Files | 0001-Eclipse-add-links-to-subdirs-which-are-not-subdirs-o.patch [^] (3,258 bytes) 2016-05-16 10:24 [Show Content] | ||||||||
Relationships | |||||||||||
|
Relationships |
Notes | |
(0037676) Christopher Buxenstein (reporter) 2015-01-13 12:18 |
Commit 077de8b2 is where this issue is first experienced by our team. We are using the Kepler release of Eclipse. We moved to CMake 3.0.2, but any release that contains commit 077de8b2 breaks our Eclipse index. |
(0037678) Brad King (manager) 2015-01-13 14:32 |
For reference, the commit mentioned in 0015347:0037676 is: Eclipse: set source path once to fix Eclipse indexer http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=077de8b2 [^] |
(0037694) Alex Neundorf (developer) 2015-01-14 17:08 |
Does project_a/CMakeLists.txt contain a project()-call ? I guess I have to do something so src-path entries are added one for CMAKE_SOURCE_DIR, and for every subdir which is not a subdirectory of CMAKE_SOURCE_DIR. |
(0037700) Christopher Buxenstein (reporter) 2015-01-15 10:33 |
The layout that our group uses differs from Tushar's example, but yes, our toplevel CMakeLists.txt includes a project(...) call. |
(0037709) Alex Neundorf (developer) 2015-01-16 08:36 |
So how is the layout which causes the problem for you ? |
(0037719) Christopher Buxenstein (reporter) 2015-01-16 14:56 |
Build CMakeLists.txt (toplevel file, includes project() call and include_directories(Folder_1 Folder_2 gtest)) gtest/CMakeLists.txt (w/ project() call) Folder_1 CMakeLists.txt (includes projects under this folder, also has a project() call) Project1/CMakeLists.txt (subproject 1, w/ project() call) Project2/CMakeLists.txt (subproject 2, w/ project() call) ... Folder_2 CMakeLists.txt (includes projects under this folder, also has a project() call) ProjectA/CMakeLists.txt (subproject A, w/ project() call) ProjectB/CMakeLists.txt (subproject B, w/ project() call) ... |
(0037720) Alex Neundorf (developer) 2015-01-16 15:52 |
Build/ is the parent directory of Folder_1/ and Folder_2/, right ? Looks completely normal. Can you create a minimal example project which shows the problem and attach it here ? Thanks Alex |
(0037724) Christopher Buxenstein (reporter) 2015-01-16 17:30 |
Build, Folder_1, and Folder_2 are all in the same directory. They are sibling folders. I should be able to create an example tomorrow. |
(0037731) Alex Neundorf (developer) 2015-01-17 15:30 |
Ah, ok, then it's clear, no need for an example. Thanks Alex |
(0040883) Alex Neundorf (developer) 2016-04-18 16:40 |
It seems I was a bit quick last year... I set up a simple project and imported it into Eclipse Kepler: d1/ CMakeLists.txt (with project call, library d1lib and executable, which links against d1lib and d2lib) d2/ CMakeLists.txt (with project call, and creates library d2lib) d2/ is added via add_subdirectory(../d2 d2bindir). All functions from d2lib are properly resolved in the main executable in d1/, so it seems to be working Ok. Is there a way to check explicitely what the indexer is doing ? All functions from d2 are |
(0040890) Christopher Buxenstein (reporter) 2016-04-19 12:20 |
I ended up compiling a custom CMake which just reverts the commit listed above for use in our project. Without that commit, indexing works fine. I'm not sure how to check what the indexer is doing. |
(0040903) Alex Neundorf (developer) 2016-04-20 16:45 |
It would be nice if you could give this a try: https://cmake.org/gitweb?p=stage/cmake.git;a=shortlog;h=refs/heads/FixEclipseProjectForSiblingDirs [^] It is basically only one commit, now also kind=src entries are addedto the project file for all project()s which are not subdirs of ${CMAKE_SOURCE_DIR}. As far as I understand it, this should fix your problem, since these entries AFAIK tell Eclipse which directories it should index. |
(0040919) Christopher Buxenstein (reporter) 2016-04-21 16:31 |
I will try to test this in the next couple of days. |
(0040926) Christopher Buxenstein (reporter) 2016-04-25 09:48 |
The change in https://cmake.org/gitweb?p=stage/cmake.git;a=shortlog;h=refs/heads/FixEclipseProjectForSiblingDirs [^] does not work for our project. Although I do see a new kind=src for each of the projects, I also see an excluding entry that excludes all of the projects. <pathentry excluding="[Source directory]/|AppSupport/|BootchartScripts/|CrashLoggerScripts/.../|watchdog_control/|**/CMakeFiles/" kind="out" path=""/> In the "working" CMake that we run that excludes http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=077de8b2, [^] that pathentry is: <pathentry excluding="**/CMakeFiles/" kind="out" path=""/> |
(0041066) Brad King (manager) 2016-05-16 10:25 |
Re 0015347:0040903: I've attached the patch from that staged topic as "0001-Eclipse-add-links-to-subdirs-which-are-not-subdirs-o.patch". However, as reported in 0015347:0040926 it may not be sufficient. |
(0042698) Kitware Robot (administrator) 2016-06-10 14:29 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2015-01-13 11:10 | Christopher Buxenstein | New Issue | |
2015-01-13 12:18 | Christopher Buxenstein | Note Added: 0037676 | |
2015-01-13 12:18 | Christopher Buxenstein | Tag Attached: Eclipse | |
2015-01-13 12:19 | Christopher Buxenstein | Tag Attached: CMake | |
2015-01-13 14:31 | Brad King | Assigned To | => Alex Neundorf |
2015-01-13 14:31 | Brad King | Status | new => assigned |
2015-01-13 14:32 | Brad King | Note Added: 0037678 | |
2015-01-13 14:32 | Brad King | Relationship added | related to 0012213 |
2015-01-13 14:32 | Brad King | Relationship added | related to 0013596 |
2015-01-14 17:08 | Alex Neundorf | Note Added: 0037694 | |
2015-01-15 10:33 | Christopher Buxenstein | Note Added: 0037700 | |
2015-01-16 08:36 | Alex Neundorf | Note Added: 0037709 | |
2015-01-16 14:56 | Christopher Buxenstein | Note Added: 0037719 | |
2015-01-16 15:52 | Alex Neundorf | Note Added: 0037720 | |
2015-01-16 17:30 | Christopher Buxenstein | Note Added: 0037724 | |
2015-01-17 15:30 | Alex Neundorf | Note Added: 0037731 | |
2016-04-18 16:40 | Alex Neundorf | Note Added: 0040883 | |
2016-04-19 12:20 | Christopher Buxenstein | Note Added: 0040890 | |
2016-04-20 16:45 | Alex Neundorf | Note Added: 0040903 | |
2016-04-21 16:31 | Christopher Buxenstein | Note Added: 0040919 | |
2016-04-25 09:48 | Christopher Buxenstein | Note Added: 0040926 | |
2016-05-16 10:25 | Brad King | File Added: 0001-Eclipse-add-links-to-subdirs-which-are-not-subdirs-o.patch | |
2016-05-16 10:25 | Brad King | Note Added: 0041066 | |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042698 | |
2016-06-10 14:29 | Kitware Robot | Status | assigned => resolved |
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |