VariableWatchTest.cmake.in 666 B

12345678910111213141516171819202122232425262728293031
  1. message("Start")
  2. variable_watch(TESTVAR MESSAGE)
  3. variable_watch(TESTVAR1)
  4. macro(testwatch var access file stack)
  5. message("There was a ${access} access done on the variable: ${var} in file ${file}")
  6. message("List file stack is: ${stack}")
  7. set(${var}_watched 1)
  8. endmacro()
  9. variable_watch(somevar testwatch)
  10. set(TESTVAR1 "1")
  11. set(TESTVAR "1")
  12. set(TESTVAR1 "0")
  13. set(TESTVAR "0")
  14. message("Variable: ${somevar}")
  15. if(NOT somevar_watched)
  16. message(SEND_ERROR "'somevar' watch failed!")
  17. endif()
  18. set(somevar_watched)
  19. set(somevar "1")
  20. message("Variable: ${somevar}")
  21. if(NOT somevar_watched)
  22. message(SEND_ERROR "'somevar' watch failed!")
  23. endif()
  24. remove(somevar)