From 064c415d275433c332b7a38eb99df5d46aaa9f9e Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 24 Oct 2014 10:47:36 -0400
Subject: [PATCH] test: add test for PARENT_SCOPE behavior

Test code courtesy of Alex Merry <alex.merry@kde.org>.
---
 Tests/RunCMake/set/ParentPulling-stderr.txt |  3 +++
 Tests/RunCMake/set/ParentPulling.cmake      | 13 +++++++++++++
 Tests/RunCMake/set/RunCMakeTest.cmake       |  1 +
 3 files changed, 17 insertions(+)
 create mode 100644 Tests/RunCMake/set/ParentPulling-stderr.txt
 create mode 100644 Tests/RunCMake/set/ParentPulling.cmake

diff --git a/Tests/RunCMake/set/ParentPulling-stderr.txt b/Tests/RunCMake/set/ParentPulling-stderr.txt
new file mode 100644
index 0000000000..768549bfa4
--- /dev/null
+++ b/Tests/RunCMake/set/ParentPulling-stderr.txt
@@ -0,0 +1,3 @@
+^before PARENT_SCOPE blah=value2
+after PARENT_SCOPE blah=value2
+in parent scope, blah=value2$
diff --git a/Tests/RunCMake/set/ParentPulling.cmake b/Tests/RunCMake/set/ParentPulling.cmake
new file mode 100644
index 0000000000..2614533f4e
--- /dev/null
+++ b/Tests/RunCMake/set/ParentPulling.cmake
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.0)
+project(Minimal NONE)
+
+function(test_set)
+    set(blah "value2")
+    message("before PARENT_SCOPE blah=${blah}")
+    set(blah ${blah} PARENT_SCOPE)
+    message("after PARENT_SCOPE blah=${blah}")
+endfunction()
+
+set(blah value1)
+test_set()
+message("in parent scope, blah=${blah}")
diff --git a/Tests/RunCMake/set/RunCMakeTest.cmake b/Tests/RunCMake/set/RunCMakeTest.cmake
index 5d036e3b8c..9caf53b102 100644
--- a/Tests/RunCMake/set/RunCMakeTest.cmake
+++ b/Tests/RunCMake/set/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
 include(RunCMake)
 
 run_cmake(PARENT_SCOPE)
+run_cmake(ParentPulling)
-- 
GitLab