ERR: Change to EscapeSpaces forces rework of Borland generator <sigh>

Add clause to prevent adding quotes when they're already present, then stuff them
onto all lib paths to prevent forward slashes causing trouble.
This commit is contained in:
John Biddiscombe 2001-09-11 21:45:35 -04:00
parent 288287b336
commit 7adaefb403
3 changed files with 31 additions and 12 deletions

View File

@ -104,6 +104,15 @@ void cmBorlandMakefileGenerator::RecursiveGenerateCacheOnly()
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Add quotes regardless of spaces in the string
std::string cmBorlandMakefileGenerator::EscapeSpaces(const char* str)
{
std::string temp = "\"";;
temp += str;
temp += "\"";
return cmSystemTools::EscapeSpaces(temp.c_str());
}
void cmBorlandMakefileGenerator::OutputMakefile(const char* file) void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
{ {
// //
@ -200,10 +209,10 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
i!=includes.end(); ++i) i!=includes.end(); ++i)
{ {
std::string include = *i; std::string include = *i;
fout << "-I" << cmSystemTools::EscapeSpaces(i->c_str()) << "; \\\n "; fout << "-I" << cmBorlandMakefileGenerator::EscapeSpaces(i->c_str()) << "; \\\n ";
} }
fout << "-I" << fout << "-I" <<
cmSystemTools::EscapeSpaces(m_Makefile->GetStartDirectory()) << "\n\n"; cmBorlandMakefileGenerator::EscapeSpaces(m_Makefile->GetStartDirectory()) << "\n\n";
// //
// for each target add to the list of targets // for each target add to the list of targets
// //
@ -282,7 +291,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
fout << "LINK_DIR ="; fout << "LINK_DIR =";
for (std::vector<std::string>::const_iterator d=linkdirs.begin(); d!=linkdirs.end(); d++) for (std::vector<std::string>::const_iterator d=linkdirs.begin(); d!=linkdirs.end(); d++)
{ {
std::string temp = cmSystemTools::EscapeSpaces(d->c_str()); std::string temp = cmBorlandMakefileGenerator::EscapeSpaces(d->c_str());
fout << temp << ";"; fout << temp << ";";
} }
fout << "\n\n"; fout << "\n\n";
@ -332,7 +341,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
{ {
libname = "$(OUTDIRLIB)\\" + libname; libname = "$(OUTDIRLIB)\\" + libname;
} }
fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str()); fout << " \\\n " << cmBorlandMakefileGenerator::EscapeSpaces(libname.c_str());
} }
} }
fout << "\n\n"; fout << "\n\n";
@ -372,7 +381,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
{ {
libname = "$(OUTDIRLIB)\\" + libname + ".bpi"; libname = "$(OUTDIRLIB)\\" + libname + ".bpi";
} }
fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str()); fout << " \\\n " << cmBorlandMakefileGenerator::EscapeSpaces(libname.c_str());
} }
} }
fout << "\n\n"; fout << "\n\n";
@ -650,7 +659,7 @@ void cmBorlandMakefileGenerator::OutputCustomRules(std::ostream& fout)
commandFiles.m_Depends.begin(); commandFiles.m_Depends.begin();
d != commandFiles.m_Depends.end(); ++d) d != commandFiles.m_Depends.end(); ++d)
{ {
std::string dep = cmSystemTools::EscapeSpaces(d->c_str()); std::string dep = cmBorlandMakefileGenerator::EscapeSpaces(d->c_str());
fout << " " << dep.c_str(); fout << " " << dep.c_str();
} }
fout << "\n\t" << command.c_str() << "\n\n"; fout << "\n\t" << command.c_str() << "\n\n";
@ -660,14 +669,14 @@ void cmBorlandMakefileGenerator::OutputCustomRules(std::ostream& fout)
commandFiles.m_Outputs.begin(); commandFiles.m_Outputs.begin();
output != commandFiles.m_Outputs.end(); ++output) output != commandFiles.m_Outputs.end(); ++output)
{ {
std::string src = cmSystemTools::EscapeSpaces(source.c_str()); std::string src = cmBorlandMakefileGenerator::EscapeSpaces(source.c_str());
fout << output->c_str() << ": " << src.c_str(); fout << output->c_str() << ": " << src.c_str();
// Write out all the dependencies for this rule. // Write out all the dependencies for this rule.
for(std::set<std::string>::const_iterator d = for(std::set<std::string>::const_iterator d =
commandFiles.m_Depends.begin(); commandFiles.m_Depends.begin();
d != commandFiles.m_Depends.end(); ++d) d != commandFiles.m_Depends.end(); ++d)
{ {
std::string dep = cmSystemTools::EscapeSpaces(d->c_str()); std::string dep = cmBorlandMakefileGenerator::EscapeSpaces(d->c_str());
fout << " " << dep.c_str(); fout << " " << dep.c_str();
} }
fout << "\n\t" << command.c_str() << "\n\n"; fout << "\n\t" << command.c_str() << "\n\n";

View File

@ -80,6 +80,8 @@ private:
const char* target, const char* target,
const char* depends, const char* depends,
const char* command); const char* command);
std::string EscapeSpaces(const char* str);
private: private:
bool m_CacheOnly; bool m_CacheOnly;
bool m_Recurse; bool m_Recurse;

View File

@ -344,10 +344,18 @@ std::string cmSystemTools::EscapeSpaces(const char* str)
// if there are spaces // if there are spaces
std::string temp = str; std::string temp = str;
if (temp.find(" ") != std::string::npos) if (temp.find(" ") != std::string::npos)
{
// don't add quotes if they're already there
if (temp.find("\"")==std::string::npos)
{ {
result = "\""; result = "\"";
}
result += cmSystemTools::HandleNetworkPaths(str); result += cmSystemTools::HandleNetworkPaths(str);
return result+"\""; if (temp.find("\"")==std::string::npos)
{
result += "\"";
}
return result;
} }
return cmSystemTools::HandleNetworkPaths(str); return cmSystemTools::HandleNetworkPaths(str);