diff options
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.cxx | 87 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.h | 6 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 8 |
5 files changed, 34 insertions, 71 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 56b9869..dd51a2d 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -380,7 +380,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, } // Compute which sources need unique object computation. - this->ComputeObjectNameRequirements(sourceGroups); + this->ComputeObjectNameRequirements(classes); // Write the DSP file's header. this->WriteDSPHeader(fout, libName, target, sourceGroups); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 7ff8892..ee5d407 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1307,7 +1307,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, } // Compute which sources need unique object computation. - this->ComputeObjectNameRequirements(sourceGroups); + this->ComputeObjectNameRequirements(classes); // open the project this->WriteProjectStart(fout, libName, target, sourceGroups); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index de1ac30..f389b35 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -83,77 +83,50 @@ bool cmLocalVisualStudioGenerator::SourceFileCompiles(const cmSourceFile* sf) } //---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator::CountObjectNames( - const std::vector<cmSourceGroup>& groups, - std::map<cmStdString, int>& counts) +void +cmLocalVisualStudioGenerator::ComputeObjectNameRequirements( + std::vector<cmSourceFile*> const& sources + ) { - for(unsigned int i = 0; i < groups.size(); ++i) + // Clear the current set of requirements. + this->NeedObjectName.clear(); + + // Count the number of object files with each name. Note that + // windows file names are not case sensitive. + std::map<cmStdString, int> counts; + for(std::vector<cmSourceFile*>::const_iterator s = sources.begin(); + s != sources.end(); ++s) { - cmSourceGroup sg = groups[i]; - std::vector<const cmSourceFile*> const& srcs = sg.GetSourceFiles(); - for(std::vector<const cmSourceFile*>::const_iterator s = srcs.begin(); - s != srcs.end(); ++s) + const cmSourceFile* sf = *s; + if(this->SourceFileCompiles(sf)) { - const cmSourceFile* sf = *s; - if(this->SourceFileCompiles(sf)) - { - std::string objectName = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension( - sf->GetFullPath())); - objectName += ".obj"; - counts[objectName] += 1; - } + std::string objectName = cmSystemTools::LowerCase( + cmSystemTools::GetFilenameWithoutLastExtension( + sf->GetFullPath())); + objectName += ".obj"; + counts[objectName] += 1; } - this->CountObjectNames(sg.GetGroupChildren(), counts); } -} -//---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator::InsertNeedObjectNames( - const std::vector<cmSourceGroup>& groups, - std::map<cmStdString, int>& count) -{ - for(unsigned int i = 0; i < groups.size(); ++i) + // For all source files producing duplicate names we need unique + // object name computation. + for(std::vector<cmSourceFile*>::const_iterator s = sources.begin(); + s != sources.end(); ++s) { - cmSourceGroup sg = groups[i]; - std::vector<const cmSourceFile*> const& srcs = sg.GetSourceFiles(); - for(std::vector<const cmSourceFile*>::const_iterator s = srcs.begin(); - s != srcs.end(); ++s) + const cmSourceFile* sf = *s; + if(this->SourceFileCompiles(sf)) { - const cmSourceFile* sf = *s; - if(this->SourceFileCompiles(sf)) + std::string objectName = cmSystemTools::LowerCase( + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); + objectName += ".obj"; + if(counts[objectName] > 1) { - std::string objectName = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); - objectName += ".obj"; - if(count[objectName] > 1) - { - this->NeedObjectName.insert(sf); - } + this->NeedObjectName.insert(sf); } } - this->InsertNeedObjectNames(sg.GetGroupChildren(), count); } } - -//---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements -(std::vector<cmSourceGroup> const& sourceGroups) -{ - // Clear the current set of requirements. - this->NeedObjectName.clear(); - - // Count the number of object files with each name. Note that - // windows file names are not case sensitive. - std::map<cmStdString, int> objectNameCounts; - this->CountObjectNames(sourceGroups, objectNameCounts); - - // For all source files producing duplicate names we need unique - // object name computation. - this->InsertNeedObjectNames(sourceGroups, objectNameCounts); -} - //---------------------------------------------------------------------------- const char* cmLocalVisualStudioGenerator::ReportErrorLabel() const { diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index fcf1f21..e58c757 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -65,12 +65,8 @@ protected: MaybeCreateImplibDir(cmTarget& target, const char* config, bool isFortran); // Safe object file name generation. - void ComputeObjectNameRequirements(std::vector<cmSourceGroup> const&); + void ComputeObjectNameRequirements(std::vector<cmSourceFile*> const&); bool SourceFileCompiles(const cmSourceFile* sf); - void CountObjectNames(const std::vector<cmSourceGroup>& groups, - std::map<cmStdString, int>& count); - void InsertNeedObjectNames(const std::vector<cmSourceGroup>& groups, - std::map<cmStdString, int>& count); std::set<const cmSourceFile*> NeedObjectName; friend class cmVisualStudio10TargetGenerator; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9418761..c3629f9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -872,9 +872,6 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() void cmVisualStudio10TargetGenerator::ComputeObjectNames() { - // We may be modifying the source groups temporarily, so make a copy. - std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups(); - // get the classes from the source lists then add them to the groups std::vector<cmSourceFile*>const & classes = this->Target->GetSourceFiles(); for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); @@ -886,13 +883,10 @@ void cmVisualStudio10TargetGenerator::ComputeObjectNames() { this->ModuleDefinitionFile = (*i)->GetFullPath(); } - cmSourceGroup& sourceGroup = - this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); - sourceGroup.AssignSource(*i); } // Compute which sources need unique object computation. - this->LocalGenerator->ComputeObjectNameRequirements(sourceGroups); + this->LocalGenerator->ComputeObjectNameRequirements(classes); } bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( |