Eclipse: move code for generating links to targets into separate function

Alex
This commit is contained in:
Alex Neundorf 2011-10-23 12:22:20 +02:00
parent cef6bd94d7
commit c3f30bdd63
2 changed files with 84 additions and 80 deletions

View File

@ -426,10 +426,33 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
{
this->CreateLinksToSubprojects(fout);
std::string linkName = "[Targets]";
this->AppendLinkedResource(fout, linkName, "virtual:/virtual",
VirtualFolder);
this->CreateLinksForTargets(fout);
}
// I'm not sure this makes too much sense. There can be different
// output directories in different subdirs, so we would need more of them.
// for EXECUTABLE_OUTPUT_PATH when not in binary dir
this->AppendOutLinkedResource(fout,
mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"),
mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"));
// for LIBRARY_OUTPUT_PATH when not in binary dir
this->AppendOutLinkedResource(fout,
mf->GetSafeDefinition("CMAKE_LIBRARY_OUTPUT_DIRECTORY"),
mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH"));
fout << "\t</linkedResources>\n";
fout << "</projectDescription>\n";
}
//----------------------------------------------------------------------------
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();
@ -456,8 +479,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
linkName2 += ti->first;
this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
VirtualFolder);
std::vector<cmSourceGroup> sourceGroups =
makefile->GetSourceGroups();
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();
@ -472,7 +494,6 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
sourceGroup.AssignSource(*sfIt);
}
for(std::vector<cmSourceGroup>::iterator sgIt = sourceGroups.begin();
sgIt != sourceGroups.end();
++sgIt)
@ -507,23 +528,6 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
}
}
// I'm not sure this makes too much sense. There can be different
// output directories in different subdirs, so we would need more of them.
// for EXECUTABLE_OUTPUT_PATH when not in binary dir
this->AppendOutLinkedResource(fout,
mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"),
mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"));
// for LIBRARY_OUTPUT_PATH when not in binary dir
this->AppendOutLinkedResource(fout,
mf->GetSafeDefinition("CMAKE_LIBRARY_OUTPUT_DIRECTORY"),
mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH"));
fout << "\t</linkedResources>\n";
fout << "</projectDescription>\n";
}
//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(

View File

@ -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;