summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-03-16 14:34:25 (GMT)
committerBrad King <brad.king@kitware.com>2007-03-16 14:34:25 (GMT)
commit1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4 (patch)
tree441301a561d9488ee57afb5d86f77629fc27e602 /Source/cmLocalUnixMakefileGenerator3.cxx
parent77da3d9b7944f1fdc8d45c35ffe6653e700d7f68 (diff)
downloadCMake-1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4.zip
CMake-1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4.tar.gz
CMake-1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4.tar.bz2
ENH: Added computation of object file names that are almost always short enough to not exceed the filesystem path length limitation. This is useful when a source file from outside the tree is referenced with a long full path. The object file name previously would contain the entire path which when combined with the build output directory could exceed the filesystem limit. Now CMake recognizes this case and replaces enough of the beginning of the full path to the source file with an md5sum of the replaced portion to make the name fit on disk. This addresses bug#4520.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx47
1 files changed, 31 insertions, 16 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 4193293..5dc1384 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1610,25 +1610,22 @@ cmLocalUnixMakefileGenerator3
const cmSourceFile& source,
std::string* nameWithoutTargetDir)
{
- // Get the object file name independent of target.
- std::string objectName = this->GetObjectFileNameWithoutTarget(source);
- if(nameWithoutTargetDir)
- {
- *nameWithoutTargetDir = objectName;
- }
-
- // Prepend the target directory.
- std::string obj;
- const char* fileTargetDirectory =
- source.GetProperty("MACOSX_PACKAGE_LOCATION");
- if ( fileTargetDirectory )
+ if(const char* fileTargetDirectory =
+ source.GetProperty("MACOSX_PACKAGE_LOCATION"))
{
+ // Special handling for OSX package files.
+ std::string objectName = this->GetObjectFileNameWithoutTarget(source, 0);
+ if(nameWithoutTargetDir)
+ {
+ *nameWithoutTargetDir = objectName;
+ }
objectName = cmSystemTools::GetFilenameName(objectName.c_str());
std::string targetName;
std::string targetNameReal;
std::string targetNamePDB;
target.GetExecutableNames(targetName, targetNameReal,
targetNamePDB, this->ConfigurationName.c_str());
+ std::string obj;
if ( target.GetPropertyAsBool("MACOSX_BUNDLE") )
{
// Construct the full path version of the names.
@@ -1644,14 +1641,32 @@ cmLocalUnixMakefileGenerator3
}
obj = cmSystemTools::RelativePath
(this->Makefile->GetHomeOutputDirectory(), obj.c_str());
+ obj += "/";
+ obj += objectName;
+ return obj;
}
else
{
- obj = this->GetTargetDirectory(target);
+ // Start with the target directory.
+ std::string obj = this->GetTargetDirectory(target);
+ obj += "/";
+
+ // Get the object file name without the target directory.
+ std::string::size_type dir_len = 0;
+ dir_len += strlen(this->Makefile->GetCurrentOutputDirectory());
+ dir_len += 1;
+ dir_len += obj.size();
+ std::string objectName =
+ this->GetObjectFileNameWithoutTarget(source, dir_len);
+ if(nameWithoutTargetDir)
+ {
+ *nameWithoutTargetDir = objectName;
+ }
+
+ // Append the object name to the target directory.
+ obj += objectName;
+ return obj;
}
- obj += "/";
- obj += objectName;
- return obj;
}
//----------------------------------------------------------------------------