summaryrefslogtreecommitdiffstats
path: root/Tests/Properties
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-03-10 15:10:59 (GMT)
committerBrad King <brad.king@kitware.com>2009-03-10 15:10:59 (GMT)
commite5e91d617940cab2ea4e8630c6c20cd09794b3a9 (patch)
tree07799700331300e0e2e2a4ffdef98f5040f20736 /Tests/Properties
parentca9fb4826f89722a5a190e0c69e6bf5c26889a55 (diff)
downloadCMake-e5e91d617940cab2ea4e8630c6c20cd09794b3a9.zip
CMake-e5e91d617940cab2ea4e8630c6c20cd09794b3a9.tar.gz
CMake-e5e91d617940cab2ea4e8630c6c20cd09794b3a9.tar.bz2
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.
Diffstat (limited to 'Tests/Properties')
-rw-r--r--Tests/Properties/CMakeLists.txt26
1 files changed, 26 insertions, 0 deletions
diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt
index 8cdd61b..6f3b539 100644
--- a/Tests/Properties/CMakeLists.txt
+++ b/Tests/Properties/CMakeLists.txt
@@ -97,3 +97,29 @@ if(NOT RESULT4)
" RESULT4=${RESULT4}"
" 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()