summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/option/CMP0077-NEW.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2018-06-21 18:53:11 (GMT)
committerBrad King <brad.king@kitware.com>2018-07-09 11:48:28 (GMT)
commit2a5f5c0e316d415e1b8207348b34761d34f191ae (patch)
treea17a979c357a3148424b71fc0bcac898b1ec7e4a /Tests/RunCMake/option/CMP0077-NEW.cmake
parent12e6f83319d089b3295b4211d0d4810575e8f7d5 (diff)
downloadCMake-2a5f5c0e316d415e1b8207348b34761d34f191ae.zip
CMake-2a5f5c0e316d415e1b8207348b34761d34f191ae.tar.gz
CMake-2a5f5c0e316d415e1b8207348b34761d34f191ae.tar.bz2
option: respect existing normal variable
Add policy CMP0077 to change this behavior in a compatible way.
Diffstat (limited to 'Tests/RunCMake/option/CMP0077-NEW.cmake')
-rw-r--r--Tests/RunCMake/option/CMP0077-NEW.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/RunCMake/option/CMP0077-NEW.cmake b/Tests/RunCMake/option/CMP0077-NEW.cmake
new file mode 100644
index 0000000..d4c518b
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-NEW.cmake
@@ -0,0 +1,14 @@
+
+#Verify that option DOESN'T overwrite existing normal variable when the policy
+#is set to NEW
+cmake_policy(SET CMP0077 NEW)
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+if(OPT_LOCAL_VAR)
+ message(FATAL_ERROR "option failed to overwrite existing normal variable")
+endif()
+
+get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET)
+if(_exists_in_cache)
+ message(FATAL_ERROR "value should not exist in cache as it was already a local variable")
+endif()