[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.2 1.3

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Sep 25 10:21:17 EDT 2008


Update of /cvsroot/CMake/CMake/Tests/Unset
In directory public:/mounts/ram/cvs-serv7122/Tests/Unset

Modified Files:
	CMakeLists.txt 
Log Message:
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.


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/Unset/CMakeLists.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** CMakeLists.txt	30 Aug 2008 14:32:52 -0000	1.2
--- CMakeLists.txt	25 Sep 2008 14:21:15 -0000	1.3
***************
*** 33,36 ****
--- 33,50 ----
  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)



More information about the Cmake-commits mailing list