summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-17 15:43:56 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-18 12:09:56 (GMT)
commit391a5837ee859c749c2a988eb873a2a9a2c58f91 (patch)
tree478a42c6182f433142114e8b68c1cd6cda0d68c8 /Tests
parent3c47ac5b2571939f7d987d9f23a9969b1f67f46e (diff)
downloadCMake-391a5837ee859c749c2a988eb873a2a9a2c58f91.zip
CMake-391a5837ee859c749c2a988eb873a2a9a2c58f91.tar.gz
CMake-391a5837ee859c749c2a988eb873a2a9a2c58f91.tar.bz2
cmake_policy: Add undocumented PARENT_SCOPE option to GET
Policies affecting the behavior of CMake-provided macros and functions need to be able to get the policy setting as of the call site rather than the definition site. Add an undocumented option to do this.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/PolicyScope/CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/Tests/PolicyScope/CMakeLists.txt b/Tests/PolicyScope/CMakeLists.txt
index 413195a..353842b 100644
--- a/Tests/PolicyScope/CMakeLists.txt
+++ b/Tests/PolicyScope/CMakeLists.txt
@@ -52,6 +52,10 @@ if(1)
# CMP0002 should be changed when this function is invoked
cmake_policy(GET CMP0002 cmp)
check(CMP0002 "OLD" "${cmp}")
+
+ # The undocumented PARENT_SCOPE option sees the caller's setting.
+ cmake_policy(GET CMP0002 cmp PARENT_SCOPE)
+ check(CMP0002 "NEW" "${cmp}")
endfunction()
# Unset CMP0002
@@ -61,6 +65,10 @@ if(1)
cmake_policy(GET CMP0002 cmp)
check(CMP0002 "" "${cmp}")
+ # The undocumented PARENT_SCOPE option sees the caller's setting.
+ cmake_policy(GET CMP0002 cmp PARENT_SCOPE)
+ check(CMP0002 "NEW" "${cmp}")
+
# Setting the policy should work here and also in the caller.
cmake_policy(SET CMP0002 OLD)
cmake_policy(GET CMP0002 cmp)