From 0c709cb2a214ec37100d38f06e1bbf157d8c4cb8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 17 Sep 2018 06:47:46 -0400 Subject: Add deprecation warnings for policies CMP0063 and below The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for some policies to encourage projects to port away from setting policies to OLD. --- Help/release/dev/deprecate-policy-old.rst | 8 ++++++++ Source/cmMakefile.cxx | 2 +- Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt | 10 ++++++++++ .../CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt | 10 ++++++++++ Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt | 10 ++++++++++ Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt | 10 ++++++++++ Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt | 10 ++++++++++ Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt | 10 ++++++++++ Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt | 13 ++++++++++++- Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt | 13 ++++++++++++- Tests/RunCMake/install/CMP0062-OLD-stderr.txt | 10 ++++++++++ Tests/RunCMake/try_compile/CMP0056-stderr.txt | 13 ++++++++++++- 12 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 Help/release/dev/deprecate-policy-old.rst create mode 100644 Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt create mode 100644 Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt create mode 100644 Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt create mode 100644 Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt create mode 100644 Tests/RunCMake/install/CMP0062-OLD-stderr.txt diff --git a/Help/release/dev/deprecate-policy-old.rst b/Help/release/dev/deprecate-policy-old.rst new file mode 100644 index 0000000..7e9862f --- /dev/null +++ b/Help/release/dev/deprecate-policy-old.rst @@ -0,0 +1,8 @@ +deprecate-policy-old +-------------------- + +* An explicit deprecation diagnostic was added for policies ``CMP0055`` + through ``CMP0063`` (``CMP0054`` and below were already deprecated). + The :manual:`cmake-policies(7)` manual explains that the OLD behaviors + of all policies are deprecated and that projects should port to the + NEW behaviors. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fdcf0a8..6e646a8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4184,7 +4184,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, // Deprecate old policies, especially those that require a lot // of code to maintain the old behavior. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0054) { + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0063) { this->IssueMessage(cmake::DEPRECATION_WARNING, cmPolicies::GetPolicyDeprecatedWarning(id)); } diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt new file mode 100644 index 0000000..d0a156c --- /dev/null +++ b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0055-OLD-Out-of-Scope.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0055 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt new file mode 100644 index 0000000..937b352 --- /dev/null +++ b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0055-OLD-Reject-Arguments.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0055 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt new file mode 100644 index 0000000..4658747 --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0060-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0060 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt new file mode 100644 index 0000000..9a606ee --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0058-OLD-by.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0058 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt new file mode 100644 index 0000000..ba6e5da --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0058-OLD-no.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0058 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt new file mode 100644 index 0000000..34ac57d --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0063-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0063 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt index 28e0e72..1938da3 100644 --- a/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt +++ b/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt @@ -1,4 +1,15 @@ -^[^ +^CMake Deprecation Warning at CMP0061-OLD-make.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0061 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +[^ ]+ --build \. --config "Release" -- -i [^ ]+ --build \. --config "Release" --target "MyTarget" -- -i diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt index 1dde843..85bbdf1 100644 --- a/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt +++ b/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt @@ -1,4 +1,15 @@ -^[^ +^CMake Deprecation Warning at CMP0061-OLD-other.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0061 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +[^ ]+ --build \. --config "Release" [^ ]+ --build \. --config "Release" --target "MyTarget" diff --git a/Tests/RunCMake/install/CMP0062-OLD-stderr.txt b/Tests/RunCMake/install/CMP0062-OLD-stderr.txt new file mode 100644 index 0000000..de0b70f --- /dev/null +++ b/Tests/RunCMake/install/CMP0062-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0062-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0062 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/CMP0056-stderr.txt b/Tests/RunCMake/try_compile/CMP0056-stderr.txt index 5c1f0e4..de44205 100644 --- a/Tests/RunCMake/try_compile/CMP0056-stderr.txt +++ b/Tests/RunCMake/try_compile/CMP0056-stderr.txt @@ -10,4 +10,15 @@ CMake Warning \(dev\) at CMP0056.cmake:[0-9]+ \(try_compile\): caller link flags \(e.g. CMAKE_EXE_LINKER_FLAGS\) in the test project. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Deprecation Warning at CMP0056.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0056 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ -- cgit v0.12