summaryrefslogtreecommitdiff
path: root/Source/cmExtraEclipseCDT4Generator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmExtraEclipseCDT4Generator.cxx')
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx25
1 files changed, 20 insertions, 5 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 96b8a0920..97ab0863c 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -38,6 +38,7 @@ cmExtraEclipseCDT4Generator
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
this->SupportsVirtualFolders = true;
+ this->GenerateLinkedResources = true;
}
//----------------------------------------------------------------------------
@@ -83,6 +84,9 @@ void cmExtraEclipseCDT4Generator::Generate()
this->HomeDirectory = mf->GetHomeDirectory();
this->HomeOutputDirectory = mf->GetHomeOutputDirectory();
+ this->GenerateLinkedResources = mf->IsOn(
+ "CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES");
+
this->IsOutOfSourceBuild = (this->HomeDirectory!=this->HomeOutputDirectory);
this->GenerateSourceProject = (this->IsOutOfSourceBuild &&
@@ -501,6 +505,10 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
linkName2 += ti->first;
this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
VirtualFolder);
+ if (!this->GenerateLinkedResources)
+ {
+ break; // skip generating the linked resources to the source files
+ }
std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups();
// get the files from the source lists then add them to the groups
cmTarget* tgt = const_cast<cmTarget*>(&ti->second);
@@ -555,6 +563,11 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
cmGeneratedFileStream& fout, const std::string& baseDir)
{
+ if (!this->GenerateLinkedResources)
+ {
+ return;
+ }
+
// for each sub project create a linked resource to the source dir
// - only if it is an out-of-source build
this->AppendLinkedResource(fout, "[Subprojects]",
@@ -579,7 +592,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
this->GetEclipsePath(linkSourceDirectory),
LinkToFolder
);
- this->SrcLinkedResources.push_back(it->first);
+ // Don't add it to the srcLinkedResources, because listing multiple
+ // directories confuses the Eclipse indexer (#13596).
}
}
}
@@ -730,15 +744,16 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
/* I don't know what the pathentry kind="src" are good for, e.g. autocompletion
* works also without them. Done wrong, the indexer complains, see #12417
* and #12213.
+ * According to #13596, this entry at least limits the directories the
+ * indexer is searching for files. So now the "src" entry contains only
+ * the linked resource to CMAKE_SOURCE_DIR.
* The CDT documentation is very terse on that:
* "CDT_SOURCE: Entry kind constant describing a path entry identifying a
* folder containing source code to be compiled."
* Also on the cdt-dev list didn't bring any information:
* http://web.archiveorange.com/archive/v/B4NlJDNIpYoOS1SbxFNy
- * So I'm disabling them for now, hoping that somebody will report if something
- * is not workging anymore.
* Alex */
-#ifdef DO_CREATE_SRC_PATH_ENTRIES
+
for (std::vector<std::string>::const_iterator
it = this->SrcLinkedResources.begin();
it != this->SrcLinkedResources.end();
@@ -755,7 +770,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
excludeFromOut += this->EscapeForXML(*it) + "/|";
}
}
-#endif
+
excludeFromOut += "**/CMakeFiles/";
fout << "<pathentry excluding=\"" << excludeFromOut
<< "\" kind=\"out\" path=\"\"/>\n";