BUG: Adjust prebuild/prelink/postbuild script construction to account for ConstructScript no longer producing trailing newlines. This addresses bug#3977.

This commit is contained in:
Brad King 2006-10-25 12:49:27 -04:00
parent e23b82c2cf
commit 89f098bc59
2 changed files with 21 additions and 10 deletions

View File

@ -766,34 +766,33 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
// header stuff // header stuff
customRuleCode += "PreLink_Cmds="; customRuleCode += "PreLink_Cmds=";
} }
const char* prelink_newline = "\\\n\t";
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target.GetPreBuildCommands().begin(); target.GetPreBuildCommands().begin();
cr != target.GetPreBuildCommands().end(); ++cr) cr != target.GetPreBuildCommands().end(); ++cr)
{ {
if(++prelink_count == prelink_total) if(prelink_count++ > 0)
{ {
prelink_newline = ""; customRuleCode += "\\\n\t";
} }
customRuleCode += this->ConstructScript(cr->GetCommandLines(), customRuleCode += this->ConstructScript(cr->GetCommandLines(),
cr->GetWorkingDirectory(), cr->GetWorkingDirectory(),
cr->GetEscapeOldStyle(), cr->GetEscapeOldStyle(),
cr->GetEscapeAllowMakeVars(), cr->GetEscapeAllowMakeVars(),
prelink_newline); "\\\n\t");
} }
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target.GetPreLinkCommands().begin(); target.GetPreLinkCommands().begin();
cr != target.GetPreLinkCommands().end(); ++cr) cr != target.GetPreLinkCommands().end(); ++cr)
{ {
if(++prelink_count == prelink_total) if(prelink_count++ > 0)
{ {
prelink_newline = ""; customRuleCode += "\\\n\t";
} }
customRuleCode += this->ConstructScript(cr->GetCommandLines(), customRuleCode += this->ConstructScript(cr->GetCommandLines(),
cr->GetWorkingDirectory(), cr->GetWorkingDirectory(),
cr->GetEscapeOldStyle(), cr->GetEscapeOldStyle(),
cr->GetEscapeAllowMakeVars(), cr->GetEscapeAllowMakeVars(),
prelink_newline); "\\\n\t");
} }
if(prelink_total > 0) if(prelink_total > 0)
{ {
@ -814,15 +813,15 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
target.GetPostBuildCommands().begin(); target.GetPostBuildCommands().begin();
cr != target.GetPostBuildCommands().end(); ++cr) cr != target.GetPostBuildCommands().end(); ++cr)
{ {
if(++postbuild_count == postbuild_total) if(postbuild_count++ > 0)
{ {
postbuild_newline = ""; customRuleCode += "\\\n\t";
} }
customRuleCode += this->ConstructScript(cr->GetCommandLines(), customRuleCode += this->ConstructScript(cr->GetCommandLines(),
cr->GetWorkingDirectory(), cr->GetWorkingDirectory(),
cr->GetEscapeOldStyle(), cr->GetEscapeOldStyle(),
cr->GetEscapeAllowMakeVars(), cr->GetEscapeAllowMakeVars(),
postbuild_newline); "\\\n\t");
} }
if(postbuild_total > 0) if(postbuild_total > 0)
{ {

View File

@ -1438,6 +1438,10 @@ void cmLocalVisualStudio7Generator
fout << "\nCommandLine=\""; fout << "\nCommandLine=\"";
init = true; init = true;
} }
else
{
fout << "\n";
}
std::string script = std::string script =
this->ConstructScript(cr->GetCommandLines(), this->ConstructScript(cr->GetCommandLines(),
cr->GetWorkingDirectory(), cr->GetWorkingDirectory(),
@ -1463,6 +1467,10 @@ void cmLocalVisualStudio7Generator
fout << "\nCommandLine=\""; fout << "\nCommandLine=\"";
init = true; init = true;
} }
else
{
fout << "\n";
}
std::string script = std::string script =
this->ConstructScript(cr->GetCommandLines(), this->ConstructScript(cr->GetCommandLines(),
cr->GetWorkingDirectory(), cr->GetWorkingDirectory(),
@ -1488,6 +1496,10 @@ void cmLocalVisualStudio7Generator
fout << "\nCommandLine=\""; fout << "\nCommandLine=\"";
init = true; init = true;
} }
else
{
fout << "\n";
}
std::string script = std::string script =
this->ConstructScript(cr->GetCommandLines(), this->ConstructScript(cr->GetCommandLines(),
cr->GetWorkingDirectory(), cr->GetWorkingDirectory(),