BUG: borland make treats ./target and target as different also convert to outputpathrelative may get passed a quoted path

This commit is contained in:
Bill Hoffman 2003-12-30 08:41:04 -05:00
parent bbfc747f2e
commit ae69928e69
2 changed files with 18 additions and 4 deletions

View File

@ -106,12 +106,15 @@ std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p)
// Do the work of converting to a relative path // Do the work of converting to a relative path
std::string pathIn = p; std::string pathIn = p;
bool ispath = false;
if(pathIn.find('/') == pathIn.npos) if(pathIn.find('/') == pathIn.npos)
{ {
return pathIn; return pathIn;
} }
if(pathIn.size() && pathIn[0] == '\"')
{
pathIn = pathIn.substr(1, pathIn.size()-2);
}
std::string ret = pathIn; std::string ret = pathIn;
if(m_CurrentOutputDirectory.size() <= ret.size()) if(m_CurrentOutputDirectory.size() <= ret.size())
@ -180,7 +183,8 @@ std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p)
{ {
ret = relpath; ret = relpath;
} }
if(ret.size() && ret[0] != '/' && ret[0] != '.') if(ret.size()
&& ret[0] != '\"' && ret[0] != '/' && ret[0] != '.')
{ {
if(ret.size() > 1 && ret[1] != ':') if(ret.size() > 1 && ret[1] != ':')
{ {

View File

@ -1323,11 +1323,21 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
target += name; target += name;
target += cmSystemTools::GetExecutableExtension(); target += cmSystemTools::GetExecutableExtension();
target = this->ConvertToRelativeOutputPath(target.c_str()); target = this->ConvertToRelativeOutputPath(target.c_str());
cmSystemTools::ConvertToUnixSlashes(target);
bool needsLocalTarget = false; bool needsLocalTarget = false;
if(target.find('/', 2) != target.npos) unsigned int startPos = 2;
if(m_Makefile->GetDefinition("BORLAND"))
{
// the borland makefiles treat .\target and target as different
// targets. All other makes treat them the same
startPos = 0;
}
if(target.find('/', startPos) != target.npos)
{ {
needsLocalTarget = true; needsLocalTarget = true;
} }
target = cmSystemTools::ConvertToOutputPath(target.c_str());
std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") "; std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
std::string depend = "$("; std::string depend = "$(";