summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-10-24 14:47:36 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2014-10-24 17:00:11 (GMT)
commit064c415d275433c332b7a38eb99df5d46aaa9f9e (patch)
tree805a9b8fc12ab7efd0bbee4834f40b86fdb85f8e /Tests
parentf25a301f3a8acc694e8c9d6f04733bfbffb1fd3c (diff)
downloadCMake-064c415d275433c332b7a38eb99df5d46aaa9f9e.zip
CMake-064c415d275433c332b7a38eb99df5d46aaa9f9e.tar.gz
CMake-064c415d275433c332b7a38eb99df5d46aaa9f9e.tar.bz2
test: add test for PARENT_SCOPE behavior
Test code courtesy of Alex Merry <alex.merry@kde.org>.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/set/ParentPulling-stderr.txt3
-rw-r--r--Tests/RunCMake/set/ParentPulling.cmake13
-rw-r--r--Tests/RunCMake/set/RunCMakeTest.cmake1
3 files changed, 17 insertions, 0 deletions
diff --git a/Tests/RunCMake/set/ParentPulling-stderr.txt b/Tests/RunCMake/set/ParentPulling-stderr.txt
new file mode 100644
index 0000000..768549b
--- /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 0000000..2614533
--- /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 5d036e3..9caf53b 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)