diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 67213ecaa3..ef46b17dae 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -24,7 +24,6 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, , OldStyle(cc.GetEscapeOldStyle()) , MakeVars(cc.GetEscapeAllowMakeVars()) , GE(new cmGeneratorExpression(cc.GetBacktrace())) - , DependsDone(false) { const cmCustomCommandLines& cmdlines = this->CC.GetCommandLines(); for (cmCustomCommandLines::const_iterator cmdline = cmdlines.begin(); @@ -44,6 +43,22 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, } this->CommandLines.push_back(argv); } + + std::vector depends = this->CC.GetDepends(); + for (std::vector::const_iterator i = depends.begin(); + i != depends.end(); ++i) { + CM_AUTO_PTR cge = this->GE->Parse(*i); + std::vector result; + cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config), + result); + for (std::vector::iterator it = result.begin(); + it != result.end(); ++it) { + if (cmSystemTools::FileIsFullPath(it->c_str())) { + *it = cmSystemTools::CollapseFullPath(*it); + } + } + this->Depends.insert(this->Depends.end(), result.begin(), result.end()); + } } cmCustomCommandGenerator::~cmCustomCommandGenerator() @@ -171,23 +186,5 @@ std::vector const& cmCustomCommandGenerator::GetByproducts() const std::vector const& cmCustomCommandGenerator::GetDepends() const { - if (!this->DependsDone) { - this->DependsDone = true; - std::vector depends = this->CC.GetDepends(); - for (std::vector::const_iterator i = depends.begin(); - i != depends.end(); ++i) { - CM_AUTO_PTR cge = this->GE->Parse(*i); - std::vector result; - cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config), - result); - for (std::vector::iterator it = result.begin(); - it != result.end(); ++it) { - if (cmSystemTools::FileIsFullPath(it->c_str())) { - *it = cmSystemTools::CollapseFullPath(*it); - } - } - this->Depends.insert(this->Depends.end(), result.begin(), result.end()); - } - } return this->Depends; } diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 0a2adb524d..ea33b51377 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -21,9 +21,8 @@ class cmCustomCommandGenerator bool OldStyle; bool MakeVars; cmGeneratorExpression* GE; - mutable bool DependsDone; - mutable std::vector Depends; cmCustomCommandLines CommandLines; + std::vector Depends; const char* GetCrossCompilingEmulator(unsigned int c) const; const char* GetArgv0Location(unsigned int c) const;