mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 14:50:15 -05:00
Eclipse: add switch to disable linked resources (#13189)
Eclipse may get confused by these linked resources, because it sees the same source file multiple times then and doesn't recognize that it's the same file actually. Alex
This commit is contained in:
@@ -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]",
|
||||
|
||||
@@ -109,6 +109,7 @@ private:
|
||||
std::string HomeOutputDirectory;
|
||||
bool IsOutOfSourceBuild;
|
||||
bool GenerateSourceProject;
|
||||
bool GenerateLinkedResources;
|
||||
bool SupportsVirtualFolders;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user