cmake/Tests/CMakeTests/VariableWatchTest.cmake.in

32 lines
666 B
CMake
Raw Normal View History

2013-03-16 19:13:01 +02:00
message("Start")
2013-03-16 19:13:01 +02:00
variable_watch(TESTVAR MESSAGE)
variable_watch(TESTVAR1)
macro(testwatch var access file stack)
2013-03-16 19:13:01 +02:00
message("There was a ${access} access done on the variable: ${var} in file ${file}")
message("List file stack is: ${stack}")
2009-10-04 10:30:41 +03:00
set(${var}_watched 1)
2013-03-16 19:13:01 +02:00
endmacro()
2013-03-16 19:13:01 +02:00
variable_watch(somevar testwatch)
set(TESTVAR1 "1")
set(TESTVAR "1")
set(TESTVAR1 "0")
set(TESTVAR "0")
message("Variable: ${somevar}")
2009-10-04 10:30:41 +03:00
if(NOT somevar_watched)
message(SEND_ERROR "'somevar' watch failed!")
endif()
set(somevar_watched)
set(somevar "1")
message("Variable: ${somevar}")
2009-10-04 10:30:41 +03:00
if(NOT somevar_watched)
message(SEND_ERROR "'somevar' watch failed!")
endif()
remove(somevar)