summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/option
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2018-07-10 17:56:15 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2018-07-10 17:56:15 (GMT)
commitf8a7cf85ad7ff9ed01987d5845dad46c395ac4fa (patch)
tree10f8144038e8f64907c5b9f2189a79d97e742f0c /Tests/RunCMake/option
parent2a5f5c0e316d415e1b8207348b34761d34f191ae (diff)
downloadCMake-f8a7cf85ad7ff9ed01987d5845dad46c395ac4fa.zip
CMake-f8a7cf85ad7ff9ed01987d5845dad46c395ac4fa.tar.gz
CMake-f8a7cf85ad7ff9ed01987d5845dad46c395ac4fa.tar.bz2
option: No CMP077 warnings when both cache and local variable exists
Previously we would warn when the local and cache version of a variable exists, but this use case doesn't need a warning as it maintains backwards compatibility.
Diffstat (limited to 'Tests/RunCMake/option')
-rw-r--r--Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake14
-rw-r--r--Tests/RunCMake/option/RunCMakeTest.cmake1
2 files changed, 15 insertions, 0 deletions
diff --git a/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake
new file mode 100644
index 0000000..f62a853
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake
@@ -0,0 +1,14 @@
+
+#Verify that when both a cache and local version of a value exist that CMake
+#doesn't produce a CMP0077 warning and that we get the expected values.
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+if(OPT_LOCAL_VAR)
+ message(FATAL_ERROR "option improperly set a cache variable that already exists")
+endif()
+
+get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET)
+if(NOT _exists_in_cache)
+ message(FATAL_ERROR "value should exist in cache")
+endif()
diff --git a/Tests/RunCMake/option/RunCMakeTest.cmake b/Tests/RunCMake/option/RunCMakeTest.cmake
index 0501624..979afa1 100644
--- a/Tests/RunCMake/option/RunCMakeTest.cmake
+++ b/Tests/RunCMake/option/RunCMakeTest.cmake
@@ -3,3 +3,4 @@ include(RunCMake)
run_cmake(CMP0077-OLD)
run_cmake(CMP0077-NEW)
run_cmake(CMP0077-WARN)
+run_cmake(CMP0077-SECOND-PASS)