CMP0005: Remove support for OLD behavior

This commit is contained in:
Brad King
2024-11-07 14:36:50 -05:00
parent 2a0a7401ce
commit 03934f16fa
3 changed files with 6 additions and 26 deletions

View File

@@ -1,6 +1,9 @@
CMP0005
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Preprocessor definition values are now escaped automatically.
This policy determines whether or not CMake should generate escaped
@@ -20,7 +23,5 @@ See documentation of the ``COMPILE_DEFINITIONS`` target property for
limitations of the escaping implementation.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
.. |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

View File

@@ -1523,27 +1523,6 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
return false;
}
// Definitions with non-trivial values require a policy check.
static cmsys::RegularExpression trivial(
"^[-/]D[A-Za-z_][A-Za-z0-9_]*(=[A-Za-z0-9_.]+)?$");
if (!trivial.find(def)) {
// This definition has a non-trivial value.
switch (this->GetPolicyStatus(cmPolicies::CMP0005)) {
case cmPolicies::WARN:
this->IssueMessage(MessageType::AUTHOR_WARNING,
cmPolicies::GetPolicyWarning(cmPolicies::CMP0005));
CM_FALLTHROUGH;
case cmPolicies::OLD:
// OLD behavior is to not escape the value. We should not
// convert the definition to use the property.
return false;
case cmPolicies::NEW:
// NEW behavior is to escape the value. Proceed to convert it
// to an entry in the property.
break;
}
}
// Get the definition part after the flag.
const char* define = def.c_str() + 2;

View File

@@ -30,7 +30,7 @@ class cmMakefile;
6, 0, NEW) \
SELECT(POLICY, CMP0005, \
"Preprocessor definition values are now escaped automatically.", 2, \
6, 0, WARN) \
6, 0, NEW) \
SELECT(POLICY, CMP0006, \
"Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \
2, 6, 0, WARN) \