summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/variable_watch
diff options
context:
space:
mode:
authorMatteo Settenvini <matteo.settenvini@here.com>2018-04-10 11:16:44 +0200
committerBrad King <brad.king@kitware.com>2018-04-11 15:02:07 -0400
commit65198cfd0f96d51269c748a84bafe27cf3312abd (patch)
tree71ef8e1935f1f8e973d5f668b65d6f4b44a174f7 /Tests/RunCMake/variable_watch
parente769e61f992ba0c0028e28bdf7531f495a625925 (diff)
downloadcmake-65198cfd0f96d51269c748a84bafe27cf3312abd.tar.gz
variable_watch: trigger on variables set via PARENT_SCOPE
Make sure that we also trigger variable watches when a variable is set in the parent scope. Fixes: #17827
Diffstat (limited to 'Tests/RunCMake/variable_watch')
-rw-r--r--Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt2
-rw-r--r--Tests/RunCMake/variable_watch/RaiseInParentScope.cmake15
-rw-r--r--Tests/RunCMake/variable_watch/RunCMakeTest.cmake1
3 files changed, 18 insertions, 0 deletions
diff --git a/Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt b/Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt
new file mode 100644
index 0000000000..51db19cc37
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/RaiseInParentScope-stderr.txt
@@ -0,0 +1,2 @@
+var MODIFIED_ACCESS a
+var MODIFIED_ACCESS b
diff --git a/Tests/RunCMake/variable_watch/RaiseInParentScope.cmake b/Tests/RunCMake/variable_watch/RaiseInParentScope.cmake
new file mode 100644
index 0000000000..207798e4b0
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/RaiseInParentScope.cmake
@@ -0,0 +1,15 @@
+
+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()
diff --git a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
index 2fa62755de..3883999c6a 100644
--- a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
+++ b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
@@ -4,3 +4,4 @@ run_cmake(ModifiedAccess)
run_cmake(NoWatcher)
run_cmake(WatchTwice)
run_cmake(ModifyWatchInCallback)
+run_cmake(RaiseInParentScope)