diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-11 17:37:26 +0100 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-03-13 15:28:02 +0100 |
commit | f6da044080d854b9ad87cef5c2a6f5195722a6da (patch) | |
tree | 9272911eaf9625896c75a8ccf0ad52560b0e6f48 /Source/cmLocalVisualStudioGenerator.cxx | |
parent | 9ad804ac7be18efb92040434808f89174586b13d (diff) | |
download | cmake-f6da044080d854b9ad87cef5c2a6f5195722a6da.tar.gz |
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.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 613ee975ce..9680d43b1a 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, |