With very long file names, VS 2010 was unable to compile files.

At some point in the past VS 2010 failed some tests with custom commands when
relative paths were not used.  It seems that those problems have been fixed.
However, the relative paths apparently are appended to the current working
directoy before vs accesses the file. So, with a long path, relative paths
cause it to create a combined path that is too long.
This commit is contained in:
Bill Hoffman 2011-03-23 15:06:44 -04:00
parent 7afcb81037
commit 945f2c2214
1 changed files with 1 additions and 10 deletions

View File

@ -367,10 +367,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
static_cast<cmGlobalVisualStudio7Generator *> static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations(); (this->GlobalGenerator)->GetConfigurations();
this->WriteString("<CustomBuild Include=\"", 2); this->WriteString("<CustomBuild Include=\"", 2);
std::string path = std::string path = sourcePath;
cmSystemTools::RelativePath(
this->Makefile->GetCurrentOutputDirectory(),
sourcePath.c_str());
this->ConvertToWindowsSlash(path); this->ConvertToWindowsSlash(path);
(*this->BuildFileStream ) << path << "\">\n"; (*this->BuildFileStream ) << path << "\">\n";
for(std::vector<std::string>::iterator i = configs->begin(); for(std::vector<std::string>::iterator i = configs->begin();
@ -609,9 +606,6 @@ WriteGroupSources(const char* name,
const char* filter = sourceGroup.GetFullName(); const char* filter = sourceGroup.GetFullName();
this->WriteString("<", 2); this->WriteString("<", 2);
std::string path = source; std::string path = source;
path = cmSystemTools::RelativePath(
this->Makefile->GetCurrentOutputDirectory(),
source.c_str());
this->ConvertToWindowsSlash(path); this->ConvertToWindowsSlash(path);
(*this->BuildFileStream) << name << " Include=\"" (*this->BuildFileStream) << name << " Include=\""
<< path; << path;
@ -685,9 +679,6 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
bool rc = lang && (strcmp(lang, "RC") == 0); bool rc = lang && (strcmp(lang, "RC") == 0);
bool idl = ext == "idl"; bool idl = ext == "idl";
std::string sourceFile = (*source)->GetFullPath(); std::string sourceFile = (*source)->GetFullPath();
sourceFile = cmSystemTools::RelativePath(
this->Makefile->GetCurrentOutputDirectory(),
sourceFile.c_str());
this->ConvertToWindowsSlash(sourceFile); this->ConvertToWindowsSlash(sourceFile);
// output the source file // output the source file
if(header) if(header)