BUG: Replaced previous fix with an implementation of properly formatting the custom build code in the generated file.
This commit is contained in:
parent
88c376f128
commit
77e22a7d70
|
@ -611,57 +611,72 @@ cmLocalVisualStudio6Generator::CreateTargetRules(const cmTarget &target,
|
||||||
}
|
}
|
||||||
|
|
||||||
customRuleCode = "# Begin Special Build Tool\n";
|
customRuleCode = "# Begin Special Build Tool\n";
|
||||||
|
|
||||||
// Do the PreBuild and PreLink (VS6 does not support both)
|
// Write the pre-build and pre-link together (VS6 does not support
|
||||||
bool init = false;
|
// both). Make sure no continuation character is put on the last
|
||||||
for (std::vector<cmCustomCommand>::const_iterator cr =
|
// line.
|
||||||
target.GetPreBuildCommands().begin();
|
int prelink_total = (static_cast<int>(target.GetPreBuildCommands().size())+
|
||||||
|
static_cast<int>(target.GetPreLinkCommands().size()));
|
||||||
|
int prelink_count = 0;
|
||||||
|
if(prelink_total > 0)
|
||||||
|
{
|
||||||
|
// header stuff
|
||||||
|
customRuleCode += "PreLink_Cmds=";
|
||||||
|
}
|
||||||
|
const char* prelink_newline = "\\\n\t";
|
||||||
|
for (std::vector<cmCustomCommand>::const_iterator cr =
|
||||||
|
target.GetPreBuildCommands().begin();
|
||||||
cr != target.GetPreBuildCommands().end(); ++cr)
|
cr != target.GetPreBuildCommands().end(); ++cr)
|
||||||
{
|
{
|
||||||
if (!init)
|
if(++prelink_count == prelink_total)
|
||||||
{
|
{
|
||||||
// header stuff
|
prelink_newline = "";
|
||||||
customRuleCode += "PreLink_Cmds=";
|
|
||||||
init = true;
|
|
||||||
}
|
}
|
||||||
customRuleCode += this->ConstructScript(cr->GetCommandLines(), "\\\n\t");
|
customRuleCode += this->ConstructScript(cr->GetCommandLines(),
|
||||||
|
prelink_newline);
|
||||||
}
|
}
|
||||||
|
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 (!init)
|
if(++prelink_count == prelink_total)
|
||||||
{
|
{
|
||||||
// header stuff
|
prelink_newline = "";
|
||||||
customRuleCode += "PreLink_Cmds=";
|
|
||||||
init = true;
|
|
||||||
}
|
}
|
||||||
customRuleCode += this->ConstructScript(cr->GetCommandLines(), "\\\n\t");
|
customRuleCode += this->ConstructScript(cr->GetCommandLines(),
|
||||||
|
prelink_newline);
|
||||||
}
|
}
|
||||||
// remove trailing \\\n\t and replace with \n as this
|
if(prelink_total > 0)
|
||||||
// is a new command and not a continuation
|
|
||||||
if(init)
|
|
||||||
{
|
{
|
||||||
customRuleCode.erase(customRuleCode.size()-3, 3);
|
|
||||||
customRuleCode += "\n";
|
customRuleCode += "\n";
|
||||||
}
|
}
|
||||||
// do the post build rules
|
|
||||||
init = false;
|
// Write the post-build rules. Make sure no continuation character
|
||||||
for (std::vector<cmCustomCommand>::const_iterator cr =
|
// is put on the last line.
|
||||||
target.GetPostBuildCommands().begin();
|
int postbuild_total = static_cast<int>(target.GetPostBuildCommands().size());
|
||||||
|
int postbuild_count = 0;
|
||||||
|
const char* postbuild_newline = "\\\n\t";
|
||||||
|
if(postbuild_total > 0)
|
||||||
|
{
|
||||||
|
customRuleCode += "PostBuild_Cmds=";
|
||||||
|
}
|
||||||
|
for (std::vector<cmCustomCommand>::const_iterator cr =
|
||||||
|
target.GetPostBuildCommands().begin();
|
||||||
cr != target.GetPostBuildCommands().end(); ++cr)
|
cr != target.GetPostBuildCommands().end(); ++cr)
|
||||||
{
|
{
|
||||||
if (!init)
|
if(++postbuild_count == postbuild_total)
|
||||||
{
|
{
|
||||||
// header stuff
|
postbuild_newline = "";
|
||||||
customRuleCode += "PostBuild_Cmds=";
|
|
||||||
init = true;
|
|
||||||
}
|
}
|
||||||
customRuleCode += this->ConstructScript(cr->GetCommandLines(), "\\\n\t");
|
customRuleCode += this->ConstructScript(cr->GetCommandLines(),
|
||||||
|
postbuild_newline);
|
||||||
|
}
|
||||||
|
if(postbuild_total > 0)
|
||||||
|
{
|
||||||
|
customRuleCode += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
customRuleCode += "\n# End Special Build Tool\n";
|
customRuleCode += "# End Special Build Tool\n";
|
||||||
return customRuleCode;
|
return customRuleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue