Index: Source/cmExtraEclipseCDT4Generator.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmExtraEclipseCDT4Generator.cxx,v retrieving revision 1.15 diff -b -u -p -r1.15 cmExtraEclipseCDT4Generator.cxx --- Source/cmExtraEclipseCDT4Generator.cxx 6 Aug 2008 19:35:52 -0000 1.15 +++ Source/cmExtraEclipseCDT4Generator.cxx 24 Nov 2008 00:14:07 -0000 @@ -350,43 +350,17 @@ void cmExtraEclipseCDT4Generator::Create this->SrcLinkedResources.push_back(it->first); } } + // for EXECUTABLE_OUTPUT_PATH when not in binary dir - std::string outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); - if (!outputPath.empty() && !cmSystemTools::IsSubDirectory( - outputPath.c_str(), this->HomeOutputDirectory.c_str())) - { - std::string name = this->GetPathBasename(outputPath); + this->AppendOutLinkedResource(fout, + mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"), + mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH")); - // make sure linked resource name is unique - while (this->GlobalGenerator->GetProjectMap().find(name) - != this->GlobalGenerator->GetProjectMap().end()) - { - name += "_"; - } - this->AppendLinkedResource(fout, name, - this->GetEclipsePath(outputPath)); - this->OutLinkedResources.push_back(name); - } // for LIBRARY_OUTPUT_PATH when not in binary dir - if (outputPath != mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH")) - { - outputPath = mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); - if (!outputPath.empty() && !cmSystemTools::IsSubDirectory( - outputPath.c_str(), this->HomeOutputDirectory.c_str())) - { - std::string name = this->GetPathBasename(outputPath); + this->AppendOutLinkedResource(fout, + mf->GetSafeDefinition("CMAKE_LIBRARY_OUTPUT_DIRECTORY"), + mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH")); - // make sure linked resource name is unique - while (this->GlobalGenerator->GetProjectMap().find(name) - != this->GlobalGenerator->GetProjectMap().end()) - { - name += "_"; - } - this->AppendLinkedResource(fout, name, - this->GetEclipsePath(outputPath)); - this->OutLinkedResources.push_back(name); - } - } fout << "\t\n"; } @@ -512,11 +486,11 @@ void cmExtraEclipseCDT4Generator::Create // exlude source directory from output search path // - only if not named the same as an output directory - if (!cmSystemTools::FileIsDirectory( - std::string(this->HomeOutputDirectory + "/" + *it).c_str())) - { - excludeFromOut += *it + "/|"; - } +// if (!cmSystemTools::FileIsDirectory( +// std::string(this->HomeOutputDirectory + "/" + *it).c_str())) +// { +// excludeFromOut += *it + "/|"; +// } } excludeFromOut += "**/CMakeFiles/"; fout << "\n" ; } + +bool cmExtraEclipseCDT4Generator +::AppendOutLinkedResource(cmGeneratedFileStream& fout, + const std::string& defname, + const std::string& altdefname) +{ + if (defname.empty() && altdefname.empty()) + { + return false; + } + + std::string outputPath = (defname.empty() ? altdefname : defname); + + if (!cmSystemTools::FileIsFullPath(outputPath.c_str())) + { + outputPath = this->HomeOutputDirectory + "/" + outputPath; + } + if (cmSystemTools::IsSubDirectory(outputPath.c_str(), + this->HomeOutputDirectory.c_str())) + { + return false; + } + + std::string name = this->GetPathBasename(outputPath); + + // make sure linked resource name is unique + while (this->GlobalGenerator->GetProjectMap().find(name) + != this->GlobalGenerator->GetProjectMap().end()) + { + name += "_"; + } + + if (std::find(this->OutLinkedResources.begin(), + this->OutLinkedResources.end(), + name) + != this->OutLinkedResources.end()) + { + return false; + } + else + { + this->AppendLinkedResource(fout, name, + this->GetEclipsePath(outputPath)); + this->OutLinkedResources.push_back(name); + return true; + } +} Index: Source/cmExtraEclipseCDT4Generator.h =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmExtraEclipseCDT4Generator.h,v retrieving revision 1.4 diff -b -u -p -r1.4 cmExtraEclipseCDT4Generator.h --- Source/cmExtraEclipseCDT4Generator.h 19 Feb 2008 21:27:03 -0000 1.4 +++ Source/cmExtraEclipseCDT4Generator.h 24 Nov 2008 00:14:07 -0000 @@ -104,6 +104,10 @@ private: const std::string& name, const std::string& path); + bool AppendOutLinkedResource(cmGeneratedFileStream& fout, + const std::string& defname, + const std::string& altdefname); + std::vector SrcLinkedResources; std::vector OutLinkedResources; std::string HomeDirectory;