Eclipse: move code for generating links to targets into separate function
Alex
This commit is contained in:
parent
cef6bd94d7
commit
c3f30bdd63
|
@ -426,85 +426,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
|
|||
{
|
||||
this->CreateLinksToSubprojects(fout);
|
||||
|
||||
std::string linkName = "[Targets]";
|
||||
this->AppendLinkedResource(fout, linkName, "virtual:/virtual",
|
||||
VirtualFolder);
|
||||
|
||||
|
||||
for (std::vector<cmLocalGenerator*>::const_iterator
|
||||
lgIt = this->GlobalGenerator->GetLocalGenerators().begin();
|
||||
lgIt != this->GlobalGenerator->GetLocalGenerators().end();
|
||||
++lgIt)
|
||||
{
|
||||
cmMakefile* makefile = (*lgIt)->GetMakefile();
|
||||
const cmTargets& targets = makefile->GetTargets();
|
||||
|
||||
for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti)
|
||||
{
|
||||
std::string linkName2 = linkName;
|
||||
linkName2 += "/";
|
||||
switch(ti->second.GetType())
|
||||
{
|
||||
case cmTarget::EXECUTABLE:
|
||||
case cmTarget::STATIC_LIBRARY:
|
||||
case cmTarget::SHARED_LIBRARY:
|
||||
case cmTarget::MODULE_LIBRARY:
|
||||
{
|
||||
const char* prefix = (ti->second.GetType()==cmTarget::EXECUTABLE ?
|
||||
"[exe] " : "[lib] ");
|
||||
linkName2 += prefix;
|
||||
linkName2 += ti->first;
|
||||
this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
|
||||
VirtualFolder);
|
||||
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);
|
||||
std::vector<cmSourceFile*>const & files = tgt->GetSourceFiles();
|
||||
for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
|
||||
sfIt != files.end();
|
||||
sfIt++)
|
||||
{
|
||||
// Add the file to the list of sources.
|
||||
std::string source = (*sfIt)->GetFullPath();
|
||||
cmSourceGroup& sourceGroup =
|
||||
makefile->FindSourceGroup(source.c_str(), sourceGroups);
|
||||
sourceGroup.AssignSource(*sfIt);
|
||||
}
|
||||
|
||||
|
||||
for(std::vector<cmSourceGroup>::iterator sgIt=sourceGroups.begin();
|
||||
sgIt != sourceGroups.end();
|
||||
++sgIt)
|
||||
{
|
||||
std::string linkName3 = linkName2;
|
||||
linkName3 += "/";
|
||||
linkName3 += sgIt->GetFullName();
|
||||
this->AppendLinkedResource(fout, linkName3, "virtual:/virtual",
|
||||
VirtualFolder);
|
||||
|
||||
std::vector<const cmSourceFile*> sFiles = sgIt->GetSourceFiles();
|
||||
for(std::vector<const cmSourceFile*>::const_iterator fileIt =
|
||||
sFiles.begin();
|
||||
fileIt != sFiles.end();
|
||||
++fileIt)
|
||||
{
|
||||
std::string linkName4 = linkName3;
|
||||
linkName4 += "/";
|
||||
linkName4 +=
|
||||
cmSystemTools::GetFilenameName((*fileIt)->GetFullPath());
|
||||
this->AppendLinkedResource(fout, linkName4,
|
||||
(*fileIt)->GetFullPath(), LinkToFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// ignore all others:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this->CreateLinksForTargets(fout);
|
||||
}
|
||||
|
||||
// I'm not sure this makes too much sense. There can be different
|
||||
|
@ -525,6 +447,88 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
|
|||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
|
||||
cmGeneratedFileStream& fout)
|
||||
{
|
||||
std::string linkName = "[Targets]";
|
||||
this->AppendLinkedResource(fout, linkName, "virtual:/virtual",VirtualFolder);
|
||||
|
||||
for (std::vector<cmLocalGenerator*>::const_iterator
|
||||
lgIt = this->GlobalGenerator->GetLocalGenerators().begin();
|
||||
lgIt != this->GlobalGenerator->GetLocalGenerators().end();
|
||||
++lgIt)
|
||||
{
|
||||
cmMakefile* makefile = (*lgIt)->GetMakefile();
|
||||
const cmTargets& targets = makefile->GetTargets();
|
||||
|
||||
for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti)
|
||||
{
|
||||
std::string linkName2 = linkName;
|
||||
linkName2 += "/";
|
||||
switch(ti->second.GetType())
|
||||
{
|
||||
case cmTarget::EXECUTABLE:
|
||||
case cmTarget::STATIC_LIBRARY:
|
||||
case cmTarget::SHARED_LIBRARY:
|
||||
case cmTarget::MODULE_LIBRARY:
|
||||
{
|
||||
const char* prefix = (ti->second.GetType()==cmTarget::EXECUTABLE ?
|
||||
"[exe] " : "[lib] ");
|
||||
linkName2 += prefix;
|
||||
linkName2 += ti->first;
|
||||
this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
|
||||
VirtualFolder);
|
||||
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);
|
||||
std::vector<cmSourceFile*>const & files = tgt->GetSourceFiles();
|
||||
for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
|
||||
sfIt != files.end();
|
||||
sfIt++)
|
||||
{
|
||||
// Add the file to the list of sources.
|
||||
std::string source = (*sfIt)->GetFullPath();
|
||||
cmSourceGroup& sourceGroup =
|
||||
makefile->FindSourceGroup(source.c_str(), sourceGroups);
|
||||
sourceGroup.AssignSource(*sfIt);
|
||||
}
|
||||
|
||||
for(std::vector<cmSourceGroup>::iterator sgIt = sourceGroups.begin();
|
||||
sgIt != sourceGroups.end();
|
||||
++sgIt)
|
||||
{
|
||||
std::string linkName3 = linkName2;
|
||||
linkName3 += "/";
|
||||
linkName3 += sgIt->GetFullName();
|
||||
this->AppendLinkedResource(fout, linkName3, "virtual:/virtual",
|
||||
VirtualFolder);
|
||||
|
||||
std::vector<const cmSourceFile*> sFiles = sgIt->GetSourceFiles();
|
||||
for(std::vector<const cmSourceFile*>::const_iterator fileIt =
|
||||
sFiles.begin();
|
||||
fileIt != sFiles.end();
|
||||
++fileIt)
|
||||
{
|
||||
std::string linkName4 = linkName3;
|
||||
linkName4 += "/";
|
||||
linkName4 +=
|
||||
cmSystemTools::GetFilenameName((*fileIt)->GetFullPath());
|
||||
this->AppendLinkedResource(fout, linkName4,
|
||||
(*fileIt)->GetFullPath(), LinkToFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// ignore all others:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
|
||||
cmGeneratedFileStream& fout)
|
||||
|
|
|
@ -104,7 +104,7 @@ private:
|
|||
cmMakefile* mf);
|
||||
|
||||
void CreateLinksToSubprojects(cmGeneratedFileStream& fout);
|
||||
|
||||
void CreateLinksForTargets(cmGeneratedFileStream& fout);
|
||||
|
||||
std::vector<std::string> SrcLinkedResources;
|
||||
std::vector<std::string> OutLinkedResources;
|
||||
|
|
Loading…
Reference in New Issue