test: add test for PARENT_SCOPE behavior

Test code courtesy of Alex Merry <alex.merry@kde.org>.
This commit is contained in:
Ben Boeckel 2014-10-24 10:47:36 -04:00
parent f25a301f3a
commit 064c415d27
3 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,3 @@
^before PARENT_SCOPE blah=value2
after PARENT_SCOPE blah=value2
in parent scope, blah=value2$

View File

@ -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}")

View File

@ -1,3 +1,4 @@
include(RunCMake)
run_cmake(PARENT_SCOPE)
run_cmake(ParentPulling)