summaryrefslogtreecommitdiffstats
path: root/Tests/PolicyScope/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-03 23:04:58 (GMT)
committerBrad King <brad.king@kitware.com>2011-01-04 12:46:10 (GMT)
commita364daf1fd1fd9079fdc13bec4fe8ea2a56efe04 (patch)
treebd2e3d1a05d13d67ceb277b449f4d345d61d837a /Tests/PolicyScope/CMakeLists.txt
parent8e45c1128cd6546a87d7ee32ace91950016f5233 (diff)
downloadCMake-a364daf1fd1fd9079fdc13bec4fe8ea2a56efe04.zip
CMake-a364daf1fd1fd9079fdc13bec4fe8ea2a56efe04.tar.gz
CMake-a364daf1fd1fd9079fdc13bec4fe8ea2a56efe04.tar.bz2
Allow users to specify defaults for unset policies
Check CMAKE_POLICY_DEFAULT_CMP<NNNN> for a default when policy CMP<NNNN> would otherwise be left unset. This allows users to set policies on the command line when the project does not set them. One may do this to quiet warnings or test whether a project will build with new behavior without modifying code. There may also be cases when users want to build an existing project release using new behavior for policies unknown to the project at the time of the release.
Diffstat (limited to 'Tests/PolicyScope/CMakeLists.txt')
-rw-r--r--Tests/PolicyScope/CMakeLists.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/Tests/PolicyScope/CMakeLists.txt b/Tests/PolicyScope/CMakeLists.txt
index 89a89ee..e6f2edc 100644
--- a/Tests/PolicyScope/CMakeLists.txt
+++ b/Tests/PolicyScope/CMakeLists.txt
@@ -82,5 +82,23 @@ cmake_policy(GET CMP0002 cmp)
check(CMP0002 "OLD" "${cmp}")
#-----------------------------------------------------------------------------
+# Test CMAKE_POLICY_DEFAULT_CMP<NNNN> variable.
+cmake_policy(PUSH)
+ set(CMAKE_POLICY_DEFAULT_CMP0010 OLD) # ignored
+ set(CMAKE_POLICY_DEFAULT_CMP0012 OLD) # honored
+ set(CMAKE_POLICY_DEFAULT_CMP0013 NEW) # honored
+ set(CMAKE_POLICY_DEFAULT_CMP0014 "") # noop
+ cmake_policy(VERSION 2.6.3)
+ cmake_policy(GET CMP0010 cmp)
+ check(CMP0010 "NEW" "${cmp}")
+ cmake_policy(GET CMP0012 cmp)
+ check(CMP0012 "OLD" "${cmp}")
+ cmake_policy(GET CMP0013 cmp)
+ check(CMP0013 "NEW" "${cmp}")
+ cmake_policy(GET CMP0014 cmp)
+ check(CMP0014 "" "${cmp}")
+cmake_policy(POP)
+
+#-----------------------------------------------------------------------------
# Dummy executable so the project can build and run.
add_executable(PolicyScope main.c)