summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudioGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-03-11 16:37:26 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-03-13 14:28:02 (GMT)
commitf6da044080d854b9ad87cef5c2a6f5195722a6da (patch)
tree9272911eaf9625896c75a8ccf0ad52560b0e6f48 /Source/cmLocalVisualStudioGenerator.cxx
parent9ad804ac7be18efb92040434808f89174586b13d (diff)
downloadCMake-f6da044080d854b9ad87cef5c2a6f5195722a6da.zip
CMake-f6da044080d854b9ad87cef5c2a6f5195722a6da.tar.gz
CMake-f6da044080d854b9ad87cef5c2a6f5195722a6da.tar.bz2
cmLocalGenerator: Add ComputeObjectFilenames interface.
Implement it in the local generators and use it in the global generators.
Diffstat (limited to 'Source/cmLocalVisualStudioGenerator.cxx')
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 613ee97..9680d43 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -31,6 +31,46 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator()
}
//----------------------------------------------------------------------------
+void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
+ std::map<cmSourceFile const*, std::string>& mapping,
+ cmGeneratorTarget const* gt)
+{
+ std::string dir_max = this->ComputeLongestObjectDirectory(*gt->Target);
+
+ // Count the number of object files with each name. Note that
+ // windows file names are not case sensitive.
+ std::map<std::string, int> counts;
+
+ for(std::map<cmSourceFile const*, std::string>::iterator
+ si = mapping.begin(); si != mapping.end(); ++si)
+ {
+ cmSourceFile const* sf = si->first;
+ std::string objectNameLower = cmSystemTools::LowerCase(
+ cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()));
+ objectNameLower += ".obj";
+ counts[objectNameLower] += 1;
+ }
+
+ // For all source files producing duplicate names we need unique
+ // object name computation.
+
+ for(std::map<cmSourceFile const*, std::string>::iterator
+ si = mapping.begin(); si != mapping.end(); ++si)
+ {
+ cmSourceFile const* sf = si->first;
+ std::string objectName =
+ cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
+ objectName += ".obj";
+ if(counts[cmSystemTools::LowerCase(objectName)] > 1)
+ {
+ const_cast<cmGeneratorTarget*>(gt)->AddExplicitObjectName(sf);
+ objectName = this->GetObjectFileNameWithoutTarget(*sf, dir_max);
+ }
+ si->second = objectName;
+ }
+}
+
+//----------------------------------------------------------------------------
cmsys::auto_ptr<cmCustomCommand>
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
const std::string& config,