summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-07-12 13:12:15 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-07-12 13:12:26 (GMT)
commit7b04ad61cf925161c8b7f9abf6ef3db047118807 (patch)
treec9c6b5538e50d3b6bc4b77d31467d0433581c000 /Tests
parent05cd8311ab52cf1e1ca40701c092602fe51cfbe4 (diff)
parentf8a7cf85ad7ff9ed01987d5845dad46c395ac4fa (diff)
downloadCMake-7b04ad61cf925161c8b7f9abf6ef3db047118807.zip
CMake-7b04ad61cf925161c8b7f9abf6ef3db047118807.tar.gz
CMake-7b04ad61cf925161c8b7f9abf6ef3db047118807.tar.bz2
Merge topic 'option_respects_existing_stack_variable'
f8a7cf85ad option: No CMP077 warnings when both cache and local variable exists Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2203
Diffstat (limited to 'Tests')
-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)