summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-10-23 11:00:45 +0200
committerAlex Neundorf <neundorf@kde.org>2011-10-23 11:00:45 +0200
commitcef6bd94d76a24c5948fea0224a78217f34c0b23 (patch)
treee87cb7e7ed8eb37281d559ac2140b97da69084f3 /Source
parentb6d4de7911c5d54c087d5616660ee7e4050da834 (diff)
downloadcmake-cef6bd94d76a24c5948fea0224a78217f34c0b23.tar.gz
Eclipse: move code for generating links to projects into separate function
Alex
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx63
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h3
2 files changed, 39 insertions, 27 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 3f63646bb9..c1a810bba5 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -424,33 +424,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
if (this->SupportsVirtualFolders)
{
- // 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]",
- "virtual:/virtual", VirtualFolder);
-
- for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
- it = this->GlobalGenerator->GetProjectMap().begin();
- it != this->GlobalGenerator->GetProjectMap().end();
- ++it)
- {
- std::string linkSourceDirectory = this->GetEclipsePath(
- it->second[0]->GetMakefile()->GetStartDirectory());
- // a linked resource must not point to a parent directory of .project or
- // .project itself
- if ((this->HomeOutputDirectory != linkSourceDirectory) &&
- !cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
- linkSourceDirectory.c_str()))
- {
- std::string linkName = "[Subprojects]/";
- linkName += it->first;
- this->AppendLinkedResource(fout, linkName,
- this->GetEclipsePath(linkSourceDirectory),
- LinkToFolder
- );
- this->SrcLinkedResources.push_back(it->first);
- }
- }
+ this->CreateLinksToSubprojects(fout);
std::string linkName = "[Targets]";
this->AppendLinkedResource(fout, linkName, "virtual:/virtual",
@@ -550,6 +524,41 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
fout << "</projectDescription>\n";
}
+
+//----------------------------------------------------------------------------
+void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
+ cmGeneratedFileStream& fout)
+{
+ // 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]",
+ "virtual:/virtual", VirtualFolder);
+
+ for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ it = this->GlobalGenerator->GetProjectMap().begin();
+ it != this->GlobalGenerator->GetProjectMap().end();
+ ++it)
+ {
+ std::string linkSourceDirectory = this->GetEclipsePath(
+ it->second[0]->GetMakefile()->GetStartDirectory());
+ // a linked resource must not point to a parent directory of .project or
+ // .project itself
+ if ((this->HomeOutputDirectory != linkSourceDirectory) &&
+ !cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
+ linkSourceDirectory.c_str()))
+ {
+ std::string linkName = "[Subprojects]/";
+ linkName += it->first;
+ this->AppendLinkedResource(fout, linkName,
+ this->GetEclipsePath(linkSourceDirectory),
+ LinkToFolder
+ );
+ this->SrcLinkedResources.push_back(it->first);
+ }
+ }
+}
+
+
//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::AppendIncludeDirectories(
cmGeneratedFileStream& fout,
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 2c7aa4398f..5a1a453419 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -103,6 +103,9 @@ private:
static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
cmMakefile* mf);
+ void CreateLinksToSubprojects(cmGeneratedFileStream& fout);
+
+
std::vector<std::string> SrcLinkedResources;
std::vector<std::string> OutLinkedResources;
std::string HomeDirectory;