summaryrefslogtreecommitdiffstats
path: root/Tests/Unset/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Unset/CMakeLists.txt')
-rw-r--r--Tests/Unset/CMakeLists.txt40
1 files changed, 40 insertions, 0 deletions
diff --git a/Tests/Unset/CMakeLists.txt b/Tests/Unset/CMakeLists.txt
new file mode 100644
index 0000000..6260950
--- /dev/null
+++ b/Tests/Unset/CMakeLists.txt
@@ -0,0 +1,40 @@
+project(Unset)
+
+# Local variable
+set(x 42)
+if(NOT x EQUAL 42)
+ message(FATAL_ERROR "x!=42")
+endif(NOT x EQUAL 42)
+
+if(NOT DEFINED x)
+ message(FATAL_ERROR "x should be defined!")
+endif(NOT DEFINED x)
+
+unset(x)
+if(DEFINED x)
+ message(FATAL_ERROR "x should be undefined now!")
+endif(DEFINED x)
+
+# Local variable test unset via set()
+set(x 43)
+if(NOT x EQUAL 43)
+ message(FATAL_ERROR "x!=43")
+endif(NOT x EQUAL 43)
+set(x)
+if(DEFINED x)
+ message(FATAL_ERROR "x should be undefined now!")
+endif(DEFINED x)
+
+# Cache variable
+set(BAR "test" CACHE STRING "documentation")
+if(NOT DEFINED BAR)
+ message(FATAL_ERROR "BAR not defined")
+endif(NOT DEFINED BAR)
+
+unset(BAR CACHE)
+if(DEFINED BAR)
+ message(FATAL_ERROR "BAR still defined")
+endif(DEFINED BAR)
+
+
+add_executable(Unset unset.cc)