summaryrefslogtreecommitdiff
path: root/Source/cmLocalVisualStudioGenerator.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-08-27 17:05:43 -0400
committerAlexander Neundorf <neundorf@kde.org>2007-08-27 17:05:43 -0400
commit94f0eca6897dcaff3d109cea78510d439adbb128 (patch)
treebfcf1ef729f7fd7e9641843cd1b57f0c7a267ddf /Source/cmLocalVisualStudioGenerator.cxx
parent8302ea66d2b385c6161c69b0afd28d64dd44f135 (diff)
downloadcmake-94f0eca6897dcaff3d109cea78510d439adbb128.tar.gz
BUG: fix #5326: source files with the same name in different groups lead to colliding object file names
Alex
Diffstat (limited to 'Source/cmLocalVisualStudioGenerator.cxx')
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx60
1 files changed, 38 insertions, 22 deletions
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index b2bacca69c..53decdf86f 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -51,18 +51,13 @@ bool cmLocalVisualStudioGenerator::SourceFileCompiles(const cmSourceFile* sf)
}
//----------------------------------------------------------------------------
-void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
-(std::vector<cmSourceGroup> const& sourceGroups)
+void cmLocalVisualStudioGenerator::CountObjectNames(
+ const std::vector<cmSourceGroup>& groups,
+ std::map<cmStdString, int>& counts)
{
- // 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;
- for(unsigned int i = 0; i < sourceGroups.size(); ++i)
+ for(unsigned int i = 0; i < groups.size(); ++i)
{
- cmSourceGroup sg = sourceGroups[i];
+ 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)
@@ -70,21 +65,25 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
const cmSourceFile* sf = *s;
if(this->SourceFileCompiles(sf))
{
- std::string objectName =
- cmSystemTools::LowerCase(
+ std::string objectName = cmSystemTools::LowerCase(
cmSystemTools::GetFilenameWithoutLastExtension(
sf->GetFullPath()));
objectName += ".obj";
- objectNameCounts[objectName] += 1;
+ counts[objectName] += 1;
}
}
+ this->CountObjectNames(sg.GetGroupChildren(), counts);
}
+}
- // For all source files producing duplicate names we need unique
- // object name computation.
- for(unsigned int i = 0; i < sourceGroups.size(); ++i)
+//----------------------------------------------------------------------------
+void cmLocalVisualStudioGenerator::InsertNeedObjectNames(
+ const std::vector<cmSourceGroup>& groups,
+ std::map<cmStdString, int>& count)
+{
+ for(unsigned int i = 0; i < groups.size(); ++i)
{
- cmSourceGroup sg = sourceGroups[i];
+ 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)
@@ -92,20 +91,37 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
const cmSourceFile* sf = *s;
if(this->SourceFileCompiles(sf))
{
- std::string objectName =
- cmSystemTools::LowerCase(
- cmSystemTools::GetFilenameWithoutLastExtension(
- sf->GetFullPath()));
+ std::string objectName = cmSystemTools::LowerCase(
+ cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()));
objectName += ".obj";
- if(objectNameCounts[objectName] > 1)
+ if(count[objectName] > 1)
{
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);
+}
+
//----------------------------------------------------------------------------
std::string
cmLocalVisualStudioGenerator