-fix bug for Eclipse projects where targets which are in a subdir which has the same name as the project (... and so the linked resource) could not be built

http://public.kitware.com/Bug/view.php?id=9978
Now instead of one linked resource for each project() just one linked
resource to the top level source directory is created.
This should really avoid this type of name clashes. And to me it looks also
much less confusing.
Hopefully the name "[Source directory]" containing a space and square
brackets doesn't lead to problems somewhere. Here it works.

Alex
This commit is contained in:
Alexander Neundorf 2010-02-13 11:08:42 -05:00
parent aa2b217d1d
commit 10aece0d81
1 changed files with 19 additions and 19 deletions

View File

@ -43,9 +43,9 @@ void cmExtraEclipseCDT4Generator
entry.Name = this->GetName(); entry.Name = this->GetName();
entry.Brief = "Generates Eclipse CDT 4.0 project files."; entry.Brief = "Generates Eclipse CDT 4.0 project files.";
entry.Full = entry.Full =
"Project files for Eclipse will be created in the top directory " "Project files for Eclipse will be created in the top directory. "
"and will have a linked resource to every subdirectory which " "In out of source builds, a linked resource to the top level source "
"features a CMakeLists.txt file containing a PROJECT() call." "directory will be created."
"Additionally a hierarchy of makefiles is generated into the " "Additionally a hierarchy of makefiles is generated into the "
"build tree. The appropriate make program can build the project through " "build tree. The appropriate make program can build the project through "
"the default make target. A \"make install\" target is also provided."; "the default make target. A \"make install\" target is also provided.";
@ -392,24 +392,24 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
if (this->IsOutOfSourceBuild) if (this->IsOutOfSourceBuild)
{ {
fout << "\t<linkedResources>\n"; fout << "\t<linkedResources>\n";
// for each sub project create a linked resource to the source dir // create a linked resource to CMAKE_SOURCE_DIR
// - only if it is an out-of-source build // (this is not done anymore for each project because of
for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator // http://public.kitware.com/Bug/view.php?id=9978 and because I found it
it = this->GlobalGenerator->GetProjectMap().begin(); // actually quite confusing in bigger projects with many directories and
it != this->GlobalGenerator->GetProjectMap().end(); // projects, Alex
++it)
{ std::string sourceLinkedResourceName = "[Source directory]";
std::string linkSourceDirectory = this->GetEclipsePath( std::string linkSourceDirectory = this->GetEclipsePath(
it->second[0]->GetMakefile()->GetStartDirectory()); mf->GetStartDirectory());
// .project dir can't be subdir of a linked resource dir // .project dir can't be subdir of a linked resource dir
if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(), if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
linkSourceDirectory.c_str())) linkSourceDirectory.c_str()))
{ {
this->AppendLinkedResource(fout, it->first, this->AppendLinkedResource(fout, sourceLinkedResourceName,
this->GetEclipsePath(linkSourceDirectory)); this->GetEclipsePath(linkSourceDirectory));
this->SrcLinkedResources.push_back(it->first); this->SrcLinkedResources.push_back(sourceLinkedResourceName);
}
} }
// for EXECUTABLE_OUTPUT_PATH when not in binary dir // for EXECUTABLE_OUTPUT_PATH when not in binary dir
this->AppendOutLinkedResource(fout, this->AppendOutLinkedResource(fout,
mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"), mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"),