1 cmake_minimum_required(VERSION 2.6)
7 message(FATAL_ERROR "x!=42")
11 message(FATAL_ERROR "x should be defined!")
16 message(FATAL_ERROR "x should be undefined now!")
19 # Local variable test unset via set()
22 message(FATAL_ERROR "x!=43")
26 message(FATAL_ERROR "x should be undefined now!")
30 set(BAR "test" CACHE STRING "documentation")
32 message(FATAL_ERROR "BAR not defined")
33 endif(NOT DEFINED BAR)
35 # Test interaction of cache entries with variables.
37 if(NOT "$CACHE{BAR}" STREQUAL "test")
38 message(FATAL_ERROR "\$CACHE{BAR} changed by variable BAR")
39 endif(NOT "$CACHE{BAR}" STREQUAL "test")
40 if(NOT "${BAR}" STREQUAL "test-var")
41 message(FATAL_ERROR "\${BAR} not separate from \$CACHE{BAR}")
42 endif(NOT "${BAR}" STREQUAL "test-var")
44 if(NOT "${BAR}" STREQUAL "test")
45 message(FATAL_ERROR "\${BAR} does not fall through to \$CACHE{BAR}")
46 endif(NOT "${BAR}" STREQUAL "test")
48 # Test unsetting of CACHE entry.
51 message(FATAL_ERROR "BAR still defined")
55 add_executable(Unset unset.c)