1
0
Эх сурвалжийг харах

Eclipse: Fix indexer for subprojects

Using `add_subdirectory(source_dir binary_dir)` with `source_dir` not a
subdirectory needs to add a `[Subprojects]` entry to the source path in
Eclipse.  The Eclipse indexer seems to use those entries as reference to
index source files.

Closes: #15984
Adam Weisi 9 жил өмнө
parent
commit
f84a3acd71

+ 8 - 0
Source/cmExtraEclipseCDT4Generator.cxx

@@ -703,6 +703,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
    * Also on the cdt-dev list didn't bring any information:
    * Also on the cdt-dev list didn't bring any information:
    * http://web.archiveorange.com/archive/v/B4NlJDNIpYoOS1SbxFNy
    * http://web.archiveorange.com/archive/v/B4NlJDNIpYoOS1SbxFNy
    * Alex */
    * Alex */
+  // include subprojects directory to the src pathentry
+  // eclipse cdt indexer uses this entries as reference to index source files
+  if (this->GenerateLinkedResources) {
+    xml.StartElement("pathentry");
+    xml.Attribute("kind", "src");
+    xml.Attribute("path", "[Subprojects]");
+    xml.EndElement();
+  }
 
 
   for (std::vector<std::string>::const_iterator it =
   for (std::vector<std::string>::const_iterator it =
          this->SrcLinkedResources.begin();
          this->SrcLinkedResources.begin();