diff --git a/Help/policy/CMP0064.rst b/Help/policy/CMP0064.rst index 4fd873f392..fca428b253 100644 --- a/Help/policy/CMP0064.rst +++ b/Help/policy/CMP0064.rst @@ -1,6 +1,9 @@ CMP0064 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + .. versionadded:: 3.4 Recognize ``TEST`` as a operator for the :command:`if` command. @@ -12,7 +15,5 @@ The ``OLD`` behavior for this policy is to ignore the ``TEST`` operator. The ``NEW`` behavior is to interpret the ``TEST`` operator. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.4 -.. |WARNS_OR_DOES_NOT_WARN| replace:: warns -.. include:: STANDARD_ADVICE.txt - -.. include:: DEPRECATED.txt +.. |WARNED_OR_DID_NOT_WARN| replace:: warned +.. include:: REMOVED_EPILOGUE.txt diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 555aeedb82..a9c6a86a60 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -218,7 +218,6 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile, cmListFileBacktrace bt) : Makefile(makefile) , Backtrace(std::move(bt)) - , Policy64Status(makefile.GetPolicyStatus(cmPolicies::CMP0064)) , Policy139Status(makefile.GetPolicyStatus(cmPolicies::CMP0139)) { } @@ -426,26 +425,6 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&, { for (auto args = newArgs.make2ArgsIterator(); args.current != newArgs.end(); args.advance(newArgs)) { - - auto policyCheck = [&, this](const cmPolicies::PolicyID id, - const cmPolicies::PolicyStatus status, - const cm::static_string_view kw) { - if (status == cmPolicies::WARN && this->IsKeyword(kw, *args.current)) { - std::ostringstream e; - e << cmPolicies::GetPolicyWarning(id) << "\n" - << kw - << " will be interpreted as an operator " - "when the policy is set to NEW. " - "Since the policy is not set the OLD behavior will be used."; - - this->Makefile.IssueMessage(MessageType::AUTHOR_WARNING, e.str()); - } - }; - - // NOTE Checking policies for warnings are not require an access to the - // next arg. Check them first! - policyCheck(cmPolicies::CMP0064, this->Policy64Status, keyTEST); - // NOTE Fail fast: All the predicates below require the next arg to be // valid if (args.next == newArgs.end()) { @@ -533,10 +512,6 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&, } // does a test exist else if (this->IsKeyword(keyTEST, *args.current)) { - if (this->Policy64Status == cmPolicies::OLD || - this->Policy64Status == cmPolicies::WARN) { - continue; - } newArgs.ReduceOneArg( static_cast(this->Makefile.GetTest(args.next->GetValue())), args); diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index bd1edc5930..fe2063554c 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -66,6 +66,5 @@ private: cmMakefile& Makefile; cmListFileBacktrace Backtrace; - cmPolicies::PolicyStatus Policy64Status; cmPolicies::PolicyStatus Policy139Status; }; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 791073afb8..33e5db9639 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -185,7 +185,7 @@ class cmMakefile; NEW) \ SELECT(POLICY, CMP0063, \ "Honor visibility properties for all target types.", 3, 3, 0, NEW) \ - SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, WARN) \ + SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, NEW) \ SELECT(POLICY, CMP0065, \ "Do not add flags to export symbols from executables without " \ "the ENABLE_EXPORTS target property.", \ diff --git a/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake b/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake index cdf50e9cab..4657471e8b 100644 --- a/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake +++ b/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake @@ -1,5 +1,3 @@ -cmake_policy(SET CMP0064 NEW) - if(NOT TEST TestThatDoesNotExist) message(STATUS "if NOT TestThatDoesNotExist is true") endif() diff --git a/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt b/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt deleted file mode 100644 index 987a50309e..0000000000 --- a/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Deprecation Warning at CMP0064-OLD.cmake:1 \(cmake_policy\): - The OLD behavior for policy CMP0064 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:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0064/CMP0064-OLD.cmake b/Tests/RunCMake/CMP0064/CMP0064-OLD.cmake deleted file mode 100644 index bffd3f3620..0000000000 --- a/Tests/RunCMake/CMP0064/CMP0064-OLD.cmake +++ /dev/null @@ -1,7 +0,0 @@ -cmake_policy(SET CMP0064 OLD) - -if(TEST) - message(FATAL_ERROR "TEST was not recognized to be undefined") -else() - message(STATUS "TEST was treated as a variable") -endif() diff --git a/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt b/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt deleted file mode 100644 index 71f1ab7722..0000000000 --- a/Tests/RunCMake/CMP0064/CMP0064-WARN-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -CMake Warning \(dev\) at CMP0064-WARN.cmake:3 \(if\): - Policy CMP0064 is not set: Support new TEST if\(\) operator. Run "cmake - --help-policy CMP0064" for policy details. Use the cmake_policy command to - set the policy and suppress this warning. - - TEST will be interpreted as an operator when the policy is set to NEW. - Since the policy is not set the OLD behavior will be used. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake b/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake deleted file mode 100644 index 8f26ec62b5..0000000000 --- a/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake +++ /dev/null @@ -1,7 +0,0 @@ - - -if(TEST) - message(FATAL_ERROR "TEST was not recognized to be undefined") -else() - message(STATUS "TEST was treated as a variable") -endif() diff --git a/Tests/RunCMake/CMP0064/CMakeLists.txt b/Tests/RunCMake/CMP0064/CMakeLists.txt index 74b3ff8de3..bf2ef1506e 100644 --- a/Tests/RunCMake/CMP0064/CMakeLists.txt +++ b/Tests/RunCMake/CMP0064/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 3.3) +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0064/RunCMakeTest.cmake b/Tests/RunCMake/CMP0064/RunCMakeTest.cmake index 4c68510eee..82de3689ec 100644 --- a/Tests/RunCMake/CMP0064/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0064/RunCMakeTest.cmake @@ -1,6 +1,3 @@ include(RunCMake) -set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON) -run_cmake(CMP0064-OLD) -run_cmake(CMP0064-WARN) run_cmake(CMP0064-NEW) diff --git a/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake b/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake index 74bc8b02fb..68ad6e3f43 100644 --- a/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake +++ b/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0064 NEW) if(TEST TestThatDoesNotExist) message(FATAL_ERROR "if TestThatDoesNotExist is true") else() diff --git a/Tests/RunCMake/if/TestNameThatExists.cmake b/Tests/RunCMake/if/TestNameThatExists.cmake index 65c2b462c1..e03e1488cc 100644 --- a/Tests/RunCMake/if/TestNameThatExists.cmake +++ b/Tests/RunCMake/if/TestNameThatExists.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0064 NEW) add_test(NAME TestThatExists COMMAND ${CMAKE_COMMAND} -E echo "A CMake Test") if(TEST TestThatExists) message(STATUS "if TestThatExists is true")