mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 06:40:48 -06:00
CMP0064: Remove support for OLD behavior
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
CMP0064
|
CMP0064
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
|
||||||
|
.. include:: REMOVED_PROLOGUE.txt
|
||||||
|
|
||||||
.. versionadded:: 3.4
|
.. versionadded:: 3.4
|
||||||
|
|
||||||
Recognize ``TEST`` as a operator for the :command:`if` command.
|
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.
|
The ``NEW`` behavior is to interpret the ``TEST`` operator.
|
||||||
|
|
||||||
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.4
|
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.4
|
||||||
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
|
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
|
||||||
.. include:: STANDARD_ADVICE.txt
|
.. include:: REMOVED_EPILOGUE.txt
|
||||||
|
|
||||||
.. include:: DEPRECATED.txt
|
|
||||||
|
|||||||
@@ -218,7 +218,6 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile,
|
|||||||
cmListFileBacktrace bt)
|
cmListFileBacktrace bt)
|
||||||
: Makefile(makefile)
|
: Makefile(makefile)
|
||||||
, Backtrace(std::move(bt))
|
, Backtrace(std::move(bt))
|
||||||
, Policy64Status(makefile.GetPolicyStatus(cmPolicies::CMP0064))
|
|
||||||
, Policy139Status(makefile.GetPolicyStatus(cmPolicies::CMP0139))
|
, 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();
|
for (auto args = newArgs.make2ArgsIterator(); args.current != newArgs.end();
|
||||||
args.advance(newArgs)) {
|
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
|
// NOTE Fail fast: All the predicates below require the next arg to be
|
||||||
// valid
|
// valid
|
||||||
if (args.next == newArgs.end()) {
|
if (args.next == newArgs.end()) {
|
||||||
@@ -533,10 +512,6 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
|
|||||||
}
|
}
|
||||||
// does a test exist
|
// does a test exist
|
||||||
else if (this->IsKeyword(keyTEST, *args.current)) {
|
else if (this->IsKeyword(keyTEST, *args.current)) {
|
||||||
if (this->Policy64Status == cmPolicies::OLD ||
|
|
||||||
this->Policy64Status == cmPolicies::WARN) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
newArgs.ReduceOneArg(
|
newArgs.ReduceOneArg(
|
||||||
static_cast<bool>(this->Makefile.GetTest(args.next->GetValue())),
|
static_cast<bool>(this->Makefile.GetTest(args.next->GetValue())),
|
||||||
args);
|
args);
|
||||||
|
|||||||
@@ -66,6 +66,5 @@ private:
|
|||||||
|
|
||||||
cmMakefile& Makefile;
|
cmMakefile& Makefile;
|
||||||
cmListFileBacktrace Backtrace;
|
cmListFileBacktrace Backtrace;
|
||||||
cmPolicies::PolicyStatus Policy64Status;
|
|
||||||
cmPolicies::PolicyStatus Policy139Status;
|
cmPolicies::PolicyStatus Policy139Status;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ class cmMakefile;
|
|||||||
NEW) \
|
NEW) \
|
||||||
SELECT(POLICY, CMP0063, \
|
SELECT(POLICY, CMP0063, \
|
||||||
"Honor visibility properties for all target types.", 3, 3, 0, NEW) \
|
"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, \
|
SELECT(POLICY, CMP0065, \
|
||||||
"Do not add flags to export symbols from executables without " \
|
"Do not add flags to export symbols from executables without " \
|
||||||
"the ENABLE_EXPORTS target property.", \
|
"the ENABLE_EXPORTS target property.", \
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
cmake_policy(SET CMP0064 NEW)
|
|
||||||
|
|
||||||
if(NOT TEST TestThatDoesNotExist)
|
if(NOT TEST TestThatDoesNotExist)
|
||||||
message(STATUS "if NOT TestThatDoesNotExist is true")
|
message(STATUS "if NOT TestThatDoesNotExist is true")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -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\)$
|
|
||||||
@@ -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()
|
|
||||||
@@ -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.
|
|
||||||
@@ -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()
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
cmake_minimum_required(VERSION 3.3)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(${RunCMake_TEST} NONE)
|
project(${RunCMake_TEST} NONE)
|
||||||
include(${RunCMake_TEST}.cmake)
|
include(${RunCMake_TEST}.cmake)
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
include(RunCMake)
|
include(RunCMake)
|
||||||
set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
|
|
||||||
|
|
||||||
run_cmake(CMP0064-OLD)
|
|
||||||
run_cmake(CMP0064-WARN)
|
|
||||||
run_cmake(CMP0064-NEW)
|
run_cmake(CMP0064-NEW)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
cmake_policy(SET CMP0064 NEW)
|
|
||||||
if(TEST TestThatDoesNotExist)
|
if(TEST TestThatDoesNotExist)
|
||||||
message(FATAL_ERROR "if TestThatDoesNotExist is true")
|
message(FATAL_ERROR "if TestThatDoesNotExist is true")
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
cmake_policy(SET CMP0064 NEW)
|
|
||||||
add_test(NAME TestThatExists COMMAND ${CMAKE_COMMAND} -E echo "A CMake Test")
|
add_test(NAME TestThatExists COMMAND ${CMAKE_COMMAND} -E echo "A CMake Test")
|
||||||
if(TEST TestThatExists)
|
if(TEST TestThatExists)
|
||||||
message(STATUS "if TestThatExists is true")
|
message(STATUS "if TestThatExists is true")
|
||||||
|
|||||||
Reference in New Issue
Block a user