summaryrefslogtreecommitdiff
path: root/Source/cmLocalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-03-11 17:37:26 +0100
committerStephen Kelly <steveire@gmail.com>2014-03-13 15:28:02 +0100
commitf6da044080d854b9ad87cef5c2a6f5195722a6da (patch)
tree9272911eaf9625896c75a8ccf0ad52560b0e6f48 /Source/cmLocalXCodeGenerator.cxx
parent9ad804ac7be18efb92040434808f89174586b13d (diff)
downloadcmake-f6da044080d854b9ad87cef5c2a6f5195722a6da.tar.gz
cmLocalGenerator: Add ComputeObjectFilenames interface.
Implement it in the local generators and use it in the global generators.
Diffstat (limited to 'Source/cmLocalXCodeGenerator.cxx')
-rw-r--r--Source/cmLocalXCodeGenerator.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 5857aefa0a..8ff6c87d68 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -71,3 +71,31 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
t->HasMacOSXRpathInstallNameDir("");
}
}
+
+//----------------------------------------------------------------------------
+void cmLocalXCodeGenerator::ComputeObjectFilenames(
+ std::map<cmSourceFile const*, std::string>& mapping,
+ cmGeneratorTarget const*)
+{
+ // Count the number of object files with each name. Warn about duplicate
+ // names since Xcode names them uniquely automatically with a numeric suffix
+ // to avoid exact duplicate file names. Note that Mac file names are not
+ // typically case sensitive, hence the LowerCase.
+ 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 objectName =
+ cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
+ objectName += ".o";
+
+ std::string objectNameLower = cmSystemTools::LowerCase(objectName);
+ counts[objectNameLower] += 1;
+ if (2 == counts[objectNameLower])
+ {
+ // TODO: emit warning about duplicate name?
+ }
+ si->second = objectName;
+ }
+}