VS 6,7: Refactor local generators to avoid GetSourceFileWithOutput

Use the cmSourceFile returned by AddCustomCommandToOutput instead of
throwing out the return value and looking it up with
GetSourceFileWithOutput.
This commit is contained in:
Brad King 2013-08-06 10:17:37 -04:00
parent 87e0e6e497
commit eccb39d7f4
2 changed files with 11 additions and 14 deletions

View File

@ -573,22 +573,20 @@ cmLocalVisualStudio6Generator
// Add the rule with the given dependencies and commands. // Add the rule with the given dependencies and commands.
const char* no_main_dependency = 0; const char* no_main_dependency = 0;
this->Makefile->AddCustomCommandToOutput(output, if(cmSourceFile* outsf =
depends, this->Makefile->AddCustomCommandToOutput(
no_main_dependency, output, depends, no_main_dependency,
origCommand.GetCommandLines(), origCommand.GetCommandLines(), comment.c_str(),
comment.c_str(), origCommand.GetWorkingDirectory()))
origCommand.GetWorkingDirectory()); {
target.AddSourceFile(outsf);
}
// Replace the dependencies with the output of this rule so that the // Replace the dependencies with the output of this rule so that the
// next rule added will run after this one. // next rule added will run after this one.
depends.clear(); depends.clear();
depends.push_back(output); depends.push_back(output);
// Add a source file representing this output to the project.
cmSourceFile* outsf = this->Makefile->GetSourceFileWithOutput(output);
target.AddSourceFile(outsf);
// Free the fake output name. // Free the fake output name.
delete [] output; delete [] output;
} }

View File

@ -146,11 +146,10 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
force += "/"; force += "/";
force += tgt.GetName(); force += tgt.GetName();
force += "_force"; force += "_force";
this->Makefile->AddCustomCommandToOutput(force.c_str(), no_depends,
no_main_dependency,
force_commands, " ", 0, true);
if(cmSourceFile* file = if(cmSourceFile* file =
this->Makefile->GetSourceFileWithOutput(force.c_str())) this->Makefile->AddCustomCommandToOutput(
force.c_str(), no_depends, no_main_dependency,
force_commands, " ", 0, true))
{ {
tgt.AddSourceFile(file); tgt.AddSourceFile(file);
} }