BUG: Custom commands should have variables expanded before comparing with previously added custom commands.

This commit is contained in:
Brad King 2003-07-14 10:33:09 -04:00
parent af8c7e7616
commit 53510fa603
1 changed files with 10 additions and 10 deletions

View File

@ -520,7 +520,7 @@ void cmMakefile::AddCustomCommand(const char* source,
void cmMakefile:: void cmMakefile::
AddCustomCommandToOutput(const char* output, AddCustomCommandToOutput(const char* output,
const char* command, const char* inCommand,
const std::vector<std::string>& commandArgs, const std::vector<std::string>& commandArgs,
const char *main_dependency, const char *main_dependency,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
@ -529,6 +529,12 @@ AddCustomCommandToOutput(const char* output,
{ {
std::string expandC; std::string expandC;
std::string combinedArgs; std::string combinedArgs;
std::string command = inCommand;
// process the command's string
this->ExpandVariablesInString(command);
command = cmSystemTools::EscapeSpaces(command.c_str());
unsigned int i; unsigned int i;
for (i = 0; i < commandArgs.size(); ++i) for (i = 0; i < commandArgs.size(); ++i)
{ {
@ -563,7 +569,7 @@ AddCustomCommandToOutput(const char* output,
// if the command and args are the same // if the command and args are the same
// as the command already there, then silently skip // as the command already there, then silently skip
// this add command // this add command
if(cc->IsEquivalent(command, combinedArgs.c_str())) if(cc->IsEquivalent(command.c_str(), combinedArgs.c_str()))
{ {
return; return;
} }
@ -585,7 +591,7 @@ AddCustomCommandToOutput(const char* output,
// if the command and args are the same // if the command and args are the same
// as the command already there, then silently skip // as the command already there, then silently skip
// this add command // this add command
if(cc->IsEquivalent(command, combinedArgs.c_str())) if(cc->IsEquivalent(command.c_str(), combinedArgs.c_str()))
{ {
return; return;
} }
@ -605,19 +611,13 @@ AddCustomCommandToOutput(const char* output,
cmSourceFile *out = this->GetOrCreateSource(output, true); cmSourceFile *out = this->GetOrCreateSource(output, true);
out->SetProperty("GENERATED","1"); out->SetProperty("GENERATED","1");
// process the command
expandC = command;
this->ExpandVariablesInString(expandC);
std::string c = cmSystemTools::EscapeSpaces(expandC.c_str());
std::vector<std::string> depends2(depends); std::vector<std::string> depends2(depends);
if (main_dependency && main_dependency[0] != '\0') if (main_dependency && main_dependency[0] != '\0')
{ {
depends2.push_back(mainDepend.c_str()); depends2.push_back(mainDepend.c_str());
} }
cmCustomCommand *cc = cmCustomCommand *cc =
new cmCustomCommand(c.c_str(),combinedArgs.c_str(),depends2, output); new cmCustomCommand(command.c_str(),combinedArgs.c_str(),depends2, output);
if ( comment && comment[0] ) if ( comment && comment[0] )
{ {
cc->SetComment(comment); cc->SetComment(comment);