summaryrefslogtreecommitdiff
path: root/Tests/CMakeTests/VariableWatchTest.cmake.in
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CMakeTests/VariableWatchTest.cmake.in')
-rw-r--r--Tests/CMakeTests/VariableWatchTest.cmake.in31
1 files changed, 31 insertions, 0 deletions
diff --git a/Tests/CMakeTests/VariableWatchTest.cmake.in b/Tests/CMakeTests/VariableWatchTest.cmake.in
new file mode 100644
index 0000000000..0c084fde87
--- /dev/null
+++ b/Tests/CMakeTests/VariableWatchTest.cmake.in
@@ -0,0 +1,31 @@
+message("Start")
+
+variable_watch(TESTVAR MESSAGE)
+variable_watch(TESTVAR1)
+
+macro(testwatch var access file stack)
+ message("There was a ${access} access done on the variable: ${var} in file ${file}")
+ message("List file stack is: ${stack}")
+ set(${var}_watched 1)
+endmacro()
+
+variable_watch(somevar testwatch)
+
+set(TESTVAR1 "1")
+set(TESTVAR "1")
+set(TESTVAR1 "0")
+set(TESTVAR "0")
+
+
+message("Variable: ${somevar}")
+if(NOT somevar_watched)
+ message(SEND_ERROR "'somevar' watch failed!")
+endif()
+set(somevar_watched)
+
+set(somevar "1")
+message("Variable: ${somevar}")
+if(NOT somevar_watched)
+ message(SEND_ERROR "'somevar' watch failed!")
+endif()
+remove(somevar)