summaryrefslogtreecommitdiff
path: root/Source/cmLocalVisualStudio6Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-03-16 10:34:25 -0400
committerBrad King <brad.king@kitware.com>2007-03-16 10:34:25 -0400
commit1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4 (patch)
tree441301a561d9488ee57afb5d86f77629fc27e602 /Source/cmLocalVisualStudio6Generator.cxx
parent77da3d9b7944f1fdc8d45c35ffe6653e700d7f68 (diff)
downloadcmake-1f639ee76cdf0f2a22d99892b7d7a79de2d79fb4.tar.gz
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/cmLocalVisualStudio6Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx29
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 6a24b0176d..3a72de6990 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -397,7 +397,32 @@ void cmLocalVisualStudio6Generator
{
this->WriteDSPBeginGroup(fout, name.c_str(), "");
}
-
+
+ // Compute the maximum length of a configuration name.
+ std::string::size_type config_len_max = 0;
+ for(std::vector<std::string>::iterator i = this->Configurations.begin();
+ i != this->Configurations.end(); ++i)
+ {
+ // Strip the subdirectory name out of the configuration name.
+ std::string config = *i;
+ std::string::size_type pos = config.find_last_of(" ");
+ config = config.substr(pos+1, std::string::npos);
+ config = config.substr(0, config.size()-1);
+ if(config.size() > config_len_max)
+ {
+ config_len_max = config.size();
+ }
+ }
+
+ // Compute the maximum length of the full path to the intermediate
+ // files directory for any configuration. This is used to construct
+ // object file names that do not produce paths that are too long.
+ std::string::size_type dir_len = 0;
+ dir_len += strlen(this->Makefile->GetCurrentOutputDirectory());
+ dir_len += 1;
+ dir_len += config_len_max;
+ dir_len += 1;
+
// Loop through each source in the source group.
for(std::vector<const cmSourceFile *>::const_iterator sf =
sourceFiles.begin(); sf != sourceFiles.end(); ++sf)
@@ -412,7 +437,7 @@ void cmLocalVisualStudio6Generator
{
objectNameDir =
cmSystemTools::GetFilenamePath(
- this->GetObjectFileNameWithoutTarget(*(*sf)));
+ this->GetObjectFileNameWithoutTarget(*(*sf), dir_len));
}
// Add per-source file flags.