summaryrefslogtreecommitdiffstats
path: root/Source/cmCustomCommandGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-08-08 18:46:48 (GMT)
committerBrad King <brad.king@kitware.com>2017-08-08 18:59:11 (GMT)
commit52527468dc9e1e35617565f1736b6ee945c4a23b (patch)
tree5d1b2725be74c3e61eeb38a88f9ea51283fbc475 /Source/cmCustomCommandGenerator.cxx
parentbfdfc6db9d51ac874ea12caa89c41a3211c917c2 (diff)
downloadCMake-52527468dc9e1e35617565f1736b6ee945c4a23b.zip
CMake-52527468dc9e1e35617565f1736b6ee945c4a23b.tar.gz
CMake-52527468dc9e1e35617565f1736b6ee945c4a23b.tar.bz2
cmCustomCommandGenerator: Avoid mutable state
Expand generator expressions of DEPENDS in the constructor instead of on-demand.
Diffstat (limited to 'Source/cmCustomCommandGenerator.cxx')
-rw-r--r--Source/cmCustomCommandGenerator.cxx35
1 files changed, 16 insertions, 19 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 67213ec..ef46b17 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<std::string> depends = this->CC.GetDepends();
+ for (std::vector<std::string>::const_iterator i = depends.begin();
+ i != depends.end(); ++i) {
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(*i);
+ std::vector<std::string> result;
+ cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config),
+ result);
+ for (std::vector<std::string>::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<std::string> const& cmCustomCommandGenerator::GetByproducts() const
std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const
{
- if (!this->DependsDone) {
- this->DependsDone = true;
- std::vector<std::string> depends = this->CC.GetDepends();
- for (std::vector<std::string>::const_iterator i = depends.begin();
- i != depends.end(); ++i) {
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(*i);
- std::vector<std::string> result;
- cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config),
- result);
- for (std::vector<std::string>::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;
}