summaryrefslogtreecommitdiffstats
path: root/Tests/Unset
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-09-25 14:21:15 (GMT)
committerBrad King <brad.king@kitware.com>2008-09-25 14:21:15 (GMT)
commitf8bc0492e174c2787780ec04979e8ca7e50d5aad (patch)
treefbad0890ee3d7196b106c1049b39c273d5cbb8db /Tests/Unset
parent883d8e186c06e4fdf4e9dd6ccce985a89d5b8d46 (diff)
downloadCMake-f8bc0492e174c2787780ec04979e8ca7e50d5aad.zip
CMake-f8bc0492e174c2787780ec04979e8ca7e50d5aad.tar.gz
CMake-f8bc0492e174c2787780ec04979e8ca7e50d5aad.tar.bz2
ENH: Create $CACHE{VAR} syntax
This syntax allows reading of cache entries even when variables of the same name have been defined in the local scope. See issue #7715.
Diffstat (limited to 'Tests/Unset')
-rw-r--r--Tests/Unset/CMakeLists.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/Unset/CMakeLists.txt b/Tests/Unset/CMakeLists.txt
index 05a7e03..bacb6d2 100644
--- a/Tests/Unset/CMakeLists.txt
+++ b/Tests/Unset/CMakeLists.txt
@@ -32,6 +32,20 @@ if(NOT DEFINED BAR)
message(FATAL_ERROR "BAR not defined")
endif(NOT DEFINED BAR)
+# Test interaction of cache entries with variables.
+set(BAR "test-var")
+if(NOT "$CACHE{BAR}" STREQUAL "test")
+ message(FATAL_ERROR "\$CACHE{BAR} changed by variable BAR")
+endif(NOT "$CACHE{BAR}" STREQUAL "test")
+if(NOT "${BAR}" STREQUAL "test-var")
+ message(FATAL_ERROR "\${BAR} not separate from \$CACHE{BAR}")
+endif(NOT "${BAR}" STREQUAL "test-var")
+unset(BAR)
+if(NOT "${BAR}" STREQUAL "test")
+ message(FATAL_ERROR "\${BAR} does not fall through to \$CACHE{BAR}")
+endif(NOT "${BAR}" STREQUAL "test")
+
+# Test unsetting of CACHE entry.
unset(BAR CACHE)
if(DEFINED BAR)
message(FATAL_ERROR "BAR still defined")