Commit 2cdefcbe authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'variable_watch-on-PARENT_SCOPE'

65198cfd

 variable_watch: trigger on variables set via PARENT_SCOPE
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1948
parents d59cd3b1 65198cfd
......@@ -3839,7 +3839,16 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef)
std::ostringstream m;
m << "Cannot set \"" << var << "\": current scope has no parent.";
this->IssueMessage(cmake::AUTHOR_WARNING, m.str());
return;
}
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
vv->VariableAccessed(var, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
varDef, this);
}
#endif
}
cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
......
var MODIFIED_ACCESS a
var MODIFIED_ACCESS b
function(watch variable access value)
message("${variable} ${access} ${value}")
endfunction ()
# --------------
variable_watch(var watch)
set(var "a")
function(f)
set(var "b" PARENT_SCOPE)
endfunction(f)
f()
......@@ -4,3 +4,4 @@ run_cmake(ModifiedAccess)
run_cmake(NoWatcher)
run_cmake(WatchTwice)
run_cmake(ModifyWatchInCallback)
run_cmake(RaiseInParentScope)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment