summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudioGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-03-06 14:31:43 (GMT)
committerBrad King <brad.king@kitware.com>2012-03-06 18:30:19 (GMT)
commit67734be8cf4cb7fa1c29ec62a19ef04dd898a08c (patch)
tree83da920648a7c7bf558e87a48f32e2aac318059b /Source/cmLocalVisualStudioGenerator.cxx
parent4ae7f3656b6ebe7c878716b95ef5eb3d924d4173 (diff)
downloadCMake-67734be8cf4cb7fa1c29ec62a19ef04dd898a08c.zip
CMake-67734be8cf4cb7fa1c29ec62a19ef04dd898a08c.tar.gz
CMake-67734be8cf4cb7fa1c29ec62a19ef04dd898a08c.tar.bz2
VS: Simplify object name computation
Simplify cmLocalVisualStudioGenerator::ComputeObjectNameRequirements to loop over the original vector of source files instead of recursively traversing source groups just to find the same files. Drop from cmVisualStudio10TargetGenerator::ComputeObjectNames temporary source group calculation now that it is not needed for computing object names.
Diffstat (limited to 'Source/cmLocalVisualStudioGenerator.cxx')
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx87
1 files changed, 30 insertions, 57 deletions
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
{