summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraEclipseCDT4Generator.cxx
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-10-23 10:22:20 (GMT)
committerAlex Neundorf <neundorf@kde.org>2011-10-23 10:22:20 (GMT)
commitc3f30bdd63682b4ba7166e23b3b3dc38548aab07 (patch)
tree9185a44f9ecf44dd0d7916e75a6f76aca0ce396a /Source/cmExtraEclipseCDT4Generator.cxx
parentcef6bd94d76a24c5948fea0224a78217f34c0b23 (diff)
downloadCMake-c3f30bdd63682b4ba7166e23b3b3dc38548aab07.zip
CMake-c3f30bdd63682b4ba7166e23b3b3dc38548aab07.tar.gz
CMake-c3f30bdd63682b4ba7166e23b3b3dc38548aab07.tar.bz2
Eclipse: move code for generating links to targets into separate function
Alex
Diffstat (limited to 'Source/cmExtraEclipseCDT4Generator.cxx')
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx162
1 files changed, 83 insertions, 79 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index c1a810b..9fc9e16 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -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
@@ -526,6 +448,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)
{