[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.8 1.9

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Mar 10 11:11:01 EDT 2009


Update of /cvsroot/CMake/CMake/Tests/Properties
In directory public:/mounts/ram/cvs-serv23956/Tests/Properties

Modified Files:
	CMakeLists.txt 
Log Message:
ENH: Teach set/get_property about CACHE properties

This adds the CACHE option to set_property and get_property commands.
This allows full control over cache entry information, so advanced users
can tweak their project cache as desired.  The set_property command
allows only pre-defined CACHE properties to be set since others would
not persist anyway.


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/Properties/CMakeLists.txt,v
retrieving revision 1.8
retrieving revision 1.9
diff -C 2 -d -r1.8 -r1.9
*** CMakeLists.txt	1 Apr 2008 18:22:09 -0000	1.8
--- CMakeLists.txt	10 Mar 2009 15:10:59 -0000	1.9
***************
*** 98,99 ****
--- 98,125 ----
      " Properties_SOURCES=[${Properties_SOURCES}]")
  endif(NOT RESULT4)
+ 
+ # test CACHE properties
+ macro(check_cache_props)
+   foreach(prop VALUE TYPE HELPSTRING ADVANCED)
+     get_property(result CACHE SOME_ENTRY PROPERTY ${prop})
+     if(NOT "x${result}" STREQUAL "x${expect_${prop}}")
+       message(SEND_ERROR "CACHE property ${prop} is [${result}], not [${expect_${prop}}]")
+     endif()
+   endforeach(prop)
+ endmacro(check_cache_props)
+ set(expect_VALUE "ON")
+ set(expect_TYPE "BOOL")
+ set(expect_HELPSTRING "sample cache entry")
+ set(expect_ADVANCED 0)
+ set(SOME_ENTRY "${expect_VALUE}" CACHE ${expect_TYPE} "${expect_HELPSTRING}" FORCE)
+ mark_as_advanced(CLEAR SOME_ENTRY)
+ check_cache_props()
+ set(expect_VALUE "Some string")
+ set(expect_TYPE "STRING")
+ set(expect_HELPSTRING "sample cache entry help")
+ set(expect_ADVANCED 1)
+ set_property(CACHE SOME_ENTRY PROPERTY TYPE "${expect_TYPE}")
+ set_property(CACHE SOME_ENTRY PROPERTY HELPSTRING "${expect_HELPSTRING}")
+ set_property(CACHE SOME_ENTRY PROPERTY VALUE "${expect_VALUE}")
+ set_property(CACHE SOME_ENTRY PROPERTY ADVANCED "${expect_ADVANCED}")
+ check_cache_props()



More information about the Cmake-commits mailing list