Browse Source

Merge topic 'simplify-removed-policies'

ff9bc7291a cmPolicies: Remove now-unused GetRequiredPolicyError method
659d8bd430 cmPolicies: Remove now-unused REQUIRED_IF_USED and REQUIRED_ALWAYS states
58a90857f0 cmPolicies: Simplify representation of removed policies
dade821948 cmPolicies: Reduce boilerplate in policy table entries
453916dfae cmPolicies: Add missing license notice
9a28b0654f cmGeneratorExpressionNode: Clarify constant in unreachable code path

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Acked-by: Craig Scott <[email protected]>
Merge-request: !9993
Brad King 11 months ago
parent
commit
03e7b8cb07
53 changed files with 239 additions and 642 deletions
  1. 0 2
      Source/cmAddCustomCommandCommand.cxx
  2. 0 2
      Source/cmAddLibraryCommand.cxx
  3. 0 4
      Source/cmBreakCommand.cxx
  4. 0 14
      Source/cmCMakePolicyCommand.cxx
  5. 11 32
      Source/cmComputeLinkDepends.cxx
  6. 0 23
      Source/cmComputeLinkInformation.cxx
  7. 0 2
      Source/cmComputeTargetDepends.cxx
  8. 0 8
      Source/cmConditionEvaluator.cxx
  9. 0 18
      Source/cmCoreTryCompile.cxx
  10. 0 2
      Source/cmDebuggerVariablesHelper.cxx
  11. 0 2
      Source/cmExportCommand.cxx
  12. 0 4
      Source/cmExportInstallFileGenerator.cxx
  13. 0 8
      Source/cmFileCommand.cxx
  14. 0 14
      Source/cmFindPackageCommand.cxx
  15. 0 2
      Source/cmFindProgramCommand.cxx
  16. 0 2
      Source/cmGeneratorExpressionEvaluationFile.cxx
  17. 1 9
      Source/cmGeneratorExpressionNode.cxx
  18. 0 13
      Source/cmGeneratorTarget.cxx
  19. 0 4
      Source/cmGeneratorTarget_IncludeDirectories.cxx
  20. 0 6
      Source/cmGeneratorTarget_Link.cxx
  21. 0 2
      Source/cmGeneratorTarget_LinkDirectories.cxx
  22. 0 2
      Source/cmGeneratorTarget_Options.cxx
  23. 0 2
      Source/cmGetDirectoryPropertyCommand.cxx
  24. 0 2
      Source/cmGetPropertyCommand.cxx
  25. 0 2
      Source/cmGetTargetPropertyCommand.cxx
  26. 0 28
      Source/cmGlobalGenerator.cxx
  27. 0 4
      Source/cmIncludeCommand.cxx
  28. 3 22
      Source/cmInstallCommand.cxx
  29. 0 6
      Source/cmInstallCommandArguments.cxx
  30. 0 2
      Source/cmInstallScriptGenerator.cxx
  31. 1 3
      Source/cmInstallSubdirectoryGenerator.cxx
  32. 0 5
      Source/cmLinkDirectoriesCommand.cxx
  33. 0 13
      Source/cmListCommand.cxx
  34. 0 23
      Source/cmLocalGenerator.cxx
  35. 0 4
      Source/cmLocalNinjaGenerator.cxx
  36. 3 62
      Source/cmMakefile.cxx
  37. 0 2
      Source/cmMakefileTargetGenerator.cxx
  38. 0 2
      Source/cmMarkAsAdvancedCommand.cxx
  39. 0 2
      Source/cmNinjaTargetGenerator.cxx
  40. 0 2
      Source/cmOptionCommand.cxx
  41. 27 28
      Source/cmPolicies.cxx
  42. 189 203
      Source/cmPolicies.h
  43. 0 6
      Source/cmQtAutoGenInitializer.cxx
  44. 0 7
      Source/cmReturnCommand.cxx
  45. 0 2
      Source/cmSourceFile.cxx
  46. 0 2
      Source/cmState.cxx
  47. 4 5
      Source/cmStateSnapshot.cxx
  48. 0 6
      Source/cmTarget.cxx
  49. 0 10
      Source/cmTargetLinkLibrariesCommand.cxx
  50. 0 2
      Source/cmTargetPropertyComputer.cxx
  51. 0 6
      Source/cmTargetSourcesCommand.cxx
  52. 0 2
      Source/cmTestGenerator.cxx
  53. 0 2
      Source/cmWhileCommand.cxx

+ 0 - 2
Source/cmAddCustomCommandCommand.cxx

@@ -610,8 +610,6 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
       case cmPolicies::OLD:
         issueMessage = false;
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::NEW:
         messageType = MessageType::FATAL_ERROR;
         break;

+ 0 - 2
Source/cmAddLibraryCommand.cxx

@@ -242,8 +242,6 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
         type = cmStateEnums::STATIC_LIBRARY;
         break;
       case cmPolicies::NEW:
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
         mf.IssueMessage(
           MessageType::FATAL_ERROR,
           cmStrCat(

+ 0 - 4
Source/cmBreakCommand.cxx

@@ -24,8 +24,6 @@ bool cmBreakCommand(std::vector<std::string> const& args,
       case cmPolicies::OLD:
         issueMessage = false;
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::NEW:
         messageType = MessageType::FATAL_ERROR;
         break;
@@ -54,8 +52,6 @@ bool cmBreakCommand(std::vector<std::string> const& args,
       case cmPolicies::OLD:
         issueMessage = false;
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::NEW:
         messageType = MessageType::FATAL_ERROR;
         break;

+ 0 - 14
Source/cmCMakePolicyCommand.cxx

@@ -4,7 +4,6 @@
 
 #include "cmExecutionStatus.h"
 #include "cmMakefile.h"
-#include "cmMessageType.h"
 #include "cmPolicies.h"
 #include "cmState.h"
 #include "cmStateTypes.h"
@@ -147,19 +146,6 @@ bool HandleGetMode(std::vector<std::string> const& args,
       // Report that the policy is set to NEW.
       status.GetMakefile().AddDefinition(var, "NEW");
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
-      // The policy is required to be set before anything needs it.
-      {
-        status.GetMakefile().IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmStrCat(
-            cmPolicies::GetRequiredPolicyError(pid), "\n",
-            "The call to cmake_policy(GET ", id,
-            " ...) at which this "
-            "error appears requests the policy, and this version of CMake ",
-            "requires that the policy be set to NEW before it is checked."));
-      }
   }
 
   return true;

+ 11 - 32
Source/cmComputeLinkDepends.cxx

@@ -373,40 +373,19 @@ public:
       case cmPolicies::OLD:
         // rely on default initialization of the class
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        makefile->GetCMakeInstance()->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0156),
-          target->GetBacktrace());
-        CM_FALLTHROUGH;
       case cmPolicies::NEW: {
         // Policy 0179 applies only when policy 0156 is new
-        switch (target->GetPolicyStatusCMP0179()) {
-          case cmPolicies::WARN:
-            if (!makefile->GetCMakeInstance()->GetIsInTryCompile() &&
-                makefile->PolicyOptionalWarningEnabled(
-                  "CMAKE_POLICY_WARNING_CMP0179")) {
-              makefile->GetCMakeInstance()->IssueMessage(
-                MessageType::AUTHOR_WARNING,
-                cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0179),
-                         "\nSince the policy is not set, static libraries "
-                         "de-duplication will keep the last occurrence of the "
-                         "static libraries."),
-                target->GetBacktrace());
-            }
-            CM_FALLTHROUGH;
-          case cmPolicies::OLD:
-            break;
-          case cmPolicies::REQUIRED_IF_USED:
-          case cmPolicies::REQUIRED_ALWAYS:
-            makefile->GetCMakeInstance()->IssueMessage(
-              MessageType::FATAL_ERROR,
-              cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0179),
-              target->GetBacktrace());
-            CM_FALLTHROUGH;
-          case cmPolicies::NEW:
-            break;
+        if (target->GetPolicyStatusCMP0179() == cmPolicies::WARN &&
+            !makefile->GetCMakeInstance()->GetIsInTryCompile() &&
+            makefile->PolicyOptionalWarningEnabled(
+              "CMAKE_POLICY_WARNING_CMP0179")) {
+          makefile->GetCMakeInstance()->IssueMessage(
+            MessageType::AUTHOR_WARNING,
+            cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0179),
+                     "\nSince the policy is not set, static libraries "
+                     "de-duplication will keep the last occurrence of the "
+                     "static libraries."),
+            target->GetBacktrace());
         }
 
         if (auto libProcessing = makefile->GetDefinition(cmStrCat(

+ 0 - 23
Source/cmComputeLinkInformation.cxx

@@ -1850,8 +1850,6 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(LinkEntry const& entry)
       CM_FALLTHROUGH;
     case cmPolicies::OLD:
       break;
-    case cmPolicies::REQUIRED_ALWAYS:
-    case cmPolicies::REQUIRED_IF_USED:
     case cmPolicies::NEW:
       return false;
   }
@@ -2205,18 +2203,6 @@ void cmComputeLinkInformation::HandleBadFullItem(LinkEntry const& entry,
     case cmPolicies::NEW:
       // NEW behavior will not get here.
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS: {
-      std::ostringstream e;
-      /* clang-format off */
-      e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0008) << "\n"
-             "Target \"" << this->Target->GetName() << "\" links to item\n"
-             "  " << item << "\n"
-             "which is a full-path but not a valid library file name.";
-      /* clang-format on */
-      this->CMakeInstance->IssueMessage(MessageType::FATAL_ERROR, e.str(),
-                                        this->Target->GetBacktrace());
-    } break;
   }
 }
 
@@ -2248,15 +2234,6 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
     case cmPolicies::NEW:
       // Should never happen due to assignment of OldLinkDirMode
       return true;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS: {
-      std::ostringstream e;
-      e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << '\n';
-      this->PrintLinkPolicyDiagnosis(e);
-      this->CMakeInstance->IssueMessage(MessageType::FATAL_ERROR, e.str(),
-                                        this->Target->GetBacktrace());
-      return false;
-    }
   }
 
   // Add the link directories for full path items.

+ 0 - 2
Source/cmComputeTargetDepends.cxx

@@ -364,8 +364,6 @@ void cmComputeTargetDepends::AddTargetDepend(size_t depender_index,
       case cmPolicies::OLD:
         break;
       case cmPolicies::NEW:
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
         issueMessage = true;
         messageType = MessageType::FATAL_ERROR;
         break;

+ 0 - 8
Source/cmConditionEvaluator.cxx

@@ -453,14 +453,6 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference(
         CM_FALLTHROUGH;
       case cmPolicies::OLD:
         return oldResult;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS: {
-        errorString = "An argument named \"" + newArg.GetValue() +
-          "\" appears in a conditional statement.  " +
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0012);
-        status = MessageType::FATAL_ERROR;
-        break;
-      }
       case cmPolicies::NEW:
         break;
     }

+ 0 - 18
Source/cmCoreTryCompile.cxx

@@ -769,12 +769,6 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
       case cmPolicies::OLD:
         // OLD behavior is to do nothing.
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        this->Makefile->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0066));
-        CM_FALLTHROUGH;
       case cmPolicies::NEW: {
         // NEW behavior is to pass config-specific compiler flags.
         std::string const cfg = !tcConfig.empty()
@@ -810,12 +804,6 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
       case cmPolicies::OLD:
         // OLD behavior is to do nothing.
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        this->Makefile->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0056));
-        CM_FALLTHROUGH;
       case cmPolicies::NEW:
         // NEW behavior is to pass linker flags.
         {
@@ -998,12 +986,6 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
           // OLD behavior is to not honor the language standard variables.
           honorStandard = false;
           break;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
-          this->Makefile->IssueMessage(
-            MessageType::FATAL_ERROR,
-            cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0067));
-          break;
         case cmPolicies::NEW:
           // NEW behavior is to honor the language standard variables.
           // We already initialized honorStandard to true.

+ 0 - 2
Source/cmDebuggerVariablesHelper.cxx

@@ -39,8 +39,6 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::Create(
     { cmPolicies::PolicyStatus::OLD, "OLD" },
     { cmPolicies::PolicyStatus::WARN, "WARN" },
     { cmPolicies::PolicyStatus::NEW, "NEW" },
-    { cmPolicies::PolicyStatus::REQUIRED_IF_USED, "REQUIRED_IF_USED" },
-    { cmPolicies::PolicyStatus::REQUIRED_ALWAYS, "REQUIRED_ALWAYS" }
   };
 
   return std::make_shared<cmDebuggerVariables>(

+ 0 - 2
Source/cmExportCommand.cxx

@@ -405,8 +405,6 @@ static bool HandlePackage(std::vector<std::string> const& args,
         return true;
       }
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       // Default is to not export, but can be enabled.
       if (!mf.IsOn("CMAKE_EXPORT_PACKAGE_REGISTRY")) {

+ 0 - 4
Source/cmExportInstallFileGenerator.cxx

@@ -439,8 +439,6 @@ bool cmExportInstallFileGenerator::CheckInterfaceDirs(
             break;
           case cmPolicies::OLD:
             continue;
-          case cmPolicies::REQUIRED_IF_USED:
-          case cmPolicies::REQUIRED_ALWAYS:
           case cmPolicies::NEW:
             hadFatalError = true;
             break; // Issue fatal message.
@@ -492,8 +490,6 @@ bool cmExportInstallFileGenerator::CheckInterfaceDirs(
             case cmPolicies::OLD:
               shouldContinue = true;
               break;
-            case cmPolicies::REQUIRED_ALWAYS:
-            case cmPolicies::REQUIRED_IF_USED:
             case cmPolicies::NEW:
               break;
           }

+ 0 - 8
Source/cmFileCommand.cxx

@@ -409,8 +409,6 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
       }
       have_regex = true;
       switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0159)) {
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
         case cmPolicies::NEW:
           // store_regex = true
           break;
@@ -685,8 +683,6 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
     status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0009);
   if (recurse) {
     switch (policyStatus) {
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
       case cmPolicies::NEW:
         g.RecurseThroughSymlinksOff();
         break;
@@ -839,8 +835,6 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
   }
 
   switch (policyStatus) {
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       // Correct behavior, yay!
       break;
@@ -1389,8 +1383,6 @@ bool HandleRealPathCommand(std::vector<std::string> const& args,
   cmPolicies::PolicyStatus policyStatus =
     status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0152);
   switch (policyStatus) {
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       break;
     case cmPolicies::WARN:

+ 0 - 14
Source/cmFindPackageCommand.cxx

@@ -1388,8 +1388,6 @@ bool cmFindPackageCommand::FindModule(bool& found)
           }
           case cmPolicies::OLD:
             break;
-          case cmPolicies::REQUIRED_IF_USED:
-          case cmPolicies::REQUIRED_ALWAYS:
           case cmPolicies::NEW:
             return true;
         }
@@ -1890,12 +1888,6 @@ void cmFindPackageCommand::PushFindPackageRootPathStack()
     case cmPolicies::OLD:
       // OLD behavior is to ignore the <PackageName>_ROOT variables.
       return;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
-      this->Makefile->IssueMessage(
-        MessageType::FATAL_ERROR,
-        cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0074));
-      return;
     case cmPolicies::NEW: {
       // NEW behavior is to honor the <PackageName>_ROOT variables.
     } break;
@@ -1926,12 +1918,6 @@ void cmFindPackageCommand::PushFindPackageRootPathStack()
       rootDEF = nullptr;
       rootENV = cm::nullopt;
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
-      this->Makefile->IssueMessage(
-        MessageType::FATAL_ERROR,
-        cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0144));
-      return;
     case cmPolicies::NEW: {
       // NEW behavior is to honor the <PACKAGENAME>_ROOT variables.
     } break;

+ 0 - 2
Source/cmFindProgramCommand.cxx

@@ -125,8 +125,6 @@ struct cmFindProgramHelper
       case cmPolicies::OLD:
         return cmSystemTools::FileExists(file, true);
       case cmPolicies::NEW:
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
         return cmSystemTools::FileIsExecutable(file);
       default:
         break;

+ 0 - 2
Source/cmGeneratorExpressionEvaluationFile.cxx

@@ -253,8 +253,6 @@ std::string cmGeneratorExpressionEvaluationFile::FixRelativePath(
       // which ends up being used relative to the working dir.
       resultPath = relativePath;
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       // NEW behavior is to interpret the relative path with respect
       // to the current source or binary directory.

+ 1 - 9
Source/cmGeneratorExpressionNode.cxx

@@ -333,8 +333,6 @@ static const struct InListNode : public cmGeneratorExpressionNode
           return "0";
         }
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
       case cmPolicies::NEW:
         values.assign(parameters[1], cmList::EmptyElements::Yes);
         break;
@@ -1931,8 +1929,6 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
           case cmPolicies::OLD:
             return "1";
           case cmPolicies::NEW:
-          case cmPolicies::REQUIRED_ALWAYS:
-          case cmPolicies::REQUIRED_IF_USED:
             break;
         }
       }
@@ -3395,7 +3391,7 @@ static cmPolicies::PolicyID policyForString(const char* policy_id)
 #undef RETURN_POLICY_ID
 
   assert(false && "Unreachable code. Not a valid policy");
-  return cmPolicies::CMP0002;
+  return cmPolicies::CMPCOUNT;
 }
 
 static const struct TargetPolicyNode : public cmGeneratorExpressionNode
@@ -3431,8 +3427,6 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
               MessageType::AUTHOR_WARNING,
               cmPolicies::GetPolicyWarning(policyForString(policy)));
             CM_FALLTHROUGH;
-          case cmPolicies::REQUIRED_IF_USED:
-          case cmPolicies::REQUIRED_ALWAYS:
           case cmPolicies::OLD:
             return "0";
           case cmPolicies::NEW:
@@ -3527,8 +3521,6 @@ struct TargetFilesystemArtifactDependencyCMP0112
       case cmPolicies::OLD:
         context->DependTargets.insert(target);
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
       case cmPolicies::NEW:
         break;
     }

+ 0 - 13
Source/cmGeneratorTarget.cxx

@@ -2474,8 +2474,6 @@ void cmGeneratorTarget::AddExplicitLanguageFlags(std::string& flags,
     case cmPolicies::OLD:
       // The OLD behavior is to not add explicit language flags.
       return;
-    case cmPolicies::REQUIRED_ALWAYS:
-    case cmPolicies::REQUIRED_IF_USED:
     case cmPolicies::NEW:
       // The NEW behavior is to add explicit language flags.
       break;
@@ -4760,15 +4758,6 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
         cm->IssueMessage(MessageType::FATAL_ERROR, e.str(),
                          this->GetBacktrace());
       } break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS: {
-        std::ostringstream e;
-        e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0004) << "\n"
-          << "Target \"" << this->GetName() << "\" links to item \"" << item
-          << "\" which has leading or trailing whitespace.";
-        cm->IssueMessage(MessageType::FATAL_ERROR, e.str(),
-                         this->GetBacktrace());
-      } break;
     }
   }
   return lib;
@@ -5927,8 +5916,6 @@ cmGeneratorTarget::CxxModuleSupport cmGeneratorTarget::NeedCxxDyndep(
       // The OLD behavior is to not scan the source.
       policyAnswer = CxxModuleSupport::Disabled;
       break;
-    case cmPolicies::REQUIRED_ALWAYS:
-    case cmPolicies::REQUIRED_IF_USED:
     case cmPolicies::NEW:
       // The NEW behavior is to scan the source if the compiler supports
       // scanning and the generator supports it.

+ 0 - 4
Source/cmGeneratorTarget_IncludeDirectories.cxx

@@ -164,8 +164,6 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
             case cmPolicies::OLD:
               messageType = MessageType::AUTHOR_WARNING;
               break;
-            case cmPolicies::REQUIRED_ALWAYS:
-            case cmPolicies::REQUIRED_IF_USED:
             case cmPolicies::NEW:
               break;
           }
@@ -204,8 +202,6 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
             case cmPolicies::OLD:
               noMessage = true;
               break;
-            case cmPolicies::REQUIRED_IF_USED:
-            case cmPolicies::REQUIRED_ALWAYS:
             case cmPolicies::NEW:
               // Issue the fatal message.
               break;

+ 0 - 6
Source/cmGeneratorTarget_Link.cxx

@@ -459,8 +459,6 @@ bool cmGeneratorTarget::VerifyLinkItemColons(LinkItemRole role,
     } break;
     case cmPolicies::OLD:
       return true;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       // Issue the fatal message.
       break;
@@ -1330,8 +1328,6 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
         case cmPolicies::WARN:
         case cmPolicies::OLD:
           break;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
         case cmPolicies::NEW:
           dagChecker.SetTransitivePropertiesOnlyCMP0131();
           break;
@@ -1390,8 +1386,6 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
             case cmPolicies::OLD:
               noMessage = true;
               break;
-            case cmPolicies::REQUIRED_IF_USED:
-            case cmPolicies::REQUIRED_ALWAYS:
             case cmPolicies::NEW:
               // Issue the fatal message.
               break;

+ 0 - 2
Source/cmGeneratorTarget_LinkDirectories.cxx

@@ -60,8 +60,6 @@ void processLinkDirectories(cmGeneratorTarget const* tgt,
             case cmPolicies::OLD:
               noMessage = true;
               break;
-            case cmPolicies::REQUIRED_IF_USED:
-            case cmPolicies::REQUIRED_ALWAYS:
             case cmPolicies::NEW:
               // Issue the fatal message.
               break;

+ 0 - 2
Source/cmGeneratorTarget_Options.cxx

@@ -363,8 +363,6 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
             this, config, language, &dagChecker, *entry));
         } break;
         case cmPolicies::NEW:
-        case cmPolicies::REQUIRED_ALWAYS:
-        case cmPolicies::REQUIRED_IF_USED:
           break;
       }
     }

+ 0 - 2
Source/cmGetDirectoryPropertyCommand.cxx

@@ -90,8 +90,6 @@ bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args,
                     status.GetMakefile().GetDefineFlagsCMP0059());
         return true;
       case cmPolicies::NEW:
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
         break;
     }
   }

+ 0 - 2
Source/cmGetPropertyCommand.cxx

@@ -380,8 +380,6 @@ bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name,
         return StoreResult(infoType, status.GetMakefile(), variable,
                            mf->GetDefineFlagsCMP0059());
       case cmPolicies::NEW:
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
         break;
     }
   }

+ 0 - 2
Source/cmGetTargetPropertyCommand.cxx

@@ -60,8 +60,6 @@ bool cmGetTargetPropertyCommand(std::vector<std::string> const& args,
         CM_FALLTHROUGH;
       case cmPolicies::OLD:
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
       case cmPolicies::NEW:
         issueMessage = true;
         messageType = MessageType::FATAL_ERROR;

+ 0 - 28
Source/cmGlobalGenerator.cxx

@@ -1057,12 +1057,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
         // OLD behavior is to convert AppleClang to Clang.
         mf->AddDefinition(compilerIdVar, "Clang");
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        mf->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0025));
-        break;
       case cmPolicies::NEW:
         // NEW behavior is to keep AppleClang.
         break;
@@ -1093,12 +1087,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
           mf->AddDefinition("CMAKE_COMPILER_IS_GNUCXX", "1");
         }
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        mf->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0047));
-        CM_FALLTHROUGH;
       case cmPolicies::NEW:
         // NEW behavior is to keep QCC.
         break;
@@ -1124,12 +1112,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
         // OLD behavior is to convert XLClang to XL.
         mf->AddDefinition(compilerIdVar, "XL");
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        mf->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0089));
-        break;
       case cmPolicies::NEW:
         // NEW behavior is to keep AppleClang.
         break;
@@ -1172,12 +1154,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
           mf->RemoveDefinition(emulated);
         }
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        mf->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0129));
-        CM_FALLTHROUGH;
       case cmPolicies::NEW:
         // NEW behavior is to keep LCC.
         break;
@@ -2820,8 +2796,6 @@ static bool RaiseCMP0037Message(cmake* cm, cmTarget* tgt,
     case cmPolicies::OLD:
       break;
     case cmPolicies::NEW:
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
       issueMessage = true;
       messageType = MessageType::FATAL_ERROR;
       break;
@@ -3028,8 +3002,6 @@ void cmGlobalGenerator::ReserveGlobalTargetCodegen()
     case cmPolicies::OLD:
       break;
     case cmPolicies::NEW:
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
       issueMessage = true;
       messageType = MessageType::FATAL_ERROR;
       break;

+ 0 - 4
Source/cmIncludeCommand.cxx

@@ -100,8 +100,6 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
           }
           case cmPolicies::OLD:
             break;
-          case cmPolicies::REQUIRED_IF_USED:
-          case cmPolicies::REQUIRED_ALWAYS:
           case cmPolicies::NEW:
             mfile = "";
             break;
@@ -130,8 +128,6 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
         CM_FALLTHROUGH;
       case cmPolicies::OLD:
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
       case cmPolicies::NEW:
         modal = "may";
         messageType = MessageType::FATAL_ERROR;

+ 3 - 22
Source/cmInstallCommand.cxx

@@ -105,7 +105,7 @@ public:
   bool MakeFilesFullPath(const char* modeName, const std::string& basePath,
                          const std::vector<std::string>& relFiles,
                          std::vector<std::string>& absFiles);
-  bool CheckCMP0006(bool& failure) const;
+  bool CheckCMP0006() const;
 
   std::string GetDestination(const cmInstallCommandArguments* args,
                              const std::string& varName,
@@ -1018,14 +1018,11 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
             bundleGenerator = CreateInstallTargetGenerator(
               target, bundleArgs, false, helper.Makefile->GetBacktrace());
           } else if (!runtimeArgs.GetDestination().empty()) {
-            bool failure = false;
-            if (helper.CheckCMP0006(failure)) {
+            if (helper.CheckCMP0006()) {
               // For CMake 2.4 compatibility fallback to the RUNTIME
               // properties.
               bundleGenerator = CreateInstallTargetGenerator(
                 target, runtimeArgs, false, helper.Makefile->GetBacktrace());
-            } else if (failure) {
-              return false;
             }
           }
           if (!bundleGenerator) {
@@ -1625,8 +1622,6 @@ bool HandleFilesMode(std::vector<std::string> const& args,
           CM_FALLTHROUGH;
         case cmPolicies::OLD:
           break;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
         case cmPolicies::NEW:
           modal = "may";
           messageType = MessageType::FATAL_ERROR;
@@ -1880,13 +1875,6 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
         case cmPolicies::OLD:
           destination = args[i];
           break;
-        case cmPolicies::REQUIRED_ALWAYS:
-        case cmPolicies::REQUIRED_IF_USED:
-          // We should never get here, only OLD, WARN, and NEW are used
-          status.GetMakefile().IssueMessage(
-            MessageType::FATAL_ERROR,
-            cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0177));
-          return false;
       }
       doing = DoingNone;
     } else if (doing == DoingType) {
@@ -2494,7 +2482,7 @@ bool Helper::MakeFilesFullPath(const char* modeName,
   return true;
 }
 
-bool Helper::CheckCMP0006(bool& failure) const
+bool Helper::CheckCMP0006() const
 {
   switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0006)) {
     case cmPolicies::WARN:
@@ -2508,13 +2496,6 @@ bool Helper::CheckCMP0006(bool& failure) const
     case cmPolicies::NEW:
       // NEW behavior is to disallow compatibility
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
-      failure = true;
-      this->Makefile->IssueMessage(
-        MessageType::FATAL_ERROR,
-        cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0006));
-      break;
   }
   return false;
 }

+ 0 - 6
Source/cmInstallCommandArguments.cxx

@@ -66,12 +66,6 @@ cmInstallCommandArguments::cmInstallCommandArguments(
         return ArgumentParser::Continue::Yes;
       };
       break;
-    case cmPolicies::REQUIRED_ALWAYS:
-    case cmPolicies::REQUIRED_IF_USED:
-      // We should never get here, only OLD, WARN, and NEW are used
-      makefile.IssueMessage(
-        MessageType::FATAL_ERROR,
-        cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0177));
   }
 
   this->Bind("DESTINATION"_s, normalizeDest);

+ 0 - 2
Source/cmInstallScriptGenerator.cxx

@@ -43,8 +43,6 @@ bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg)
       case cmPolicies::OLD:
         break;
       case cmPolicies::NEW:
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
         this->AllowGenex = true;
         break;
     }

+ 1 - 3
Source/cmInstallSubdirectoryGenerator.cxx

@@ -63,9 +63,7 @@ void cmInstallSubdirectoryGenerator::GenerateScript(std::ostream& os)
         // OLD behavior is handled in cmLocalGenerator::GenerateInstallRules()
         break;
 
-      case cmPolicies::NEW:
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS: {
+      case cmPolicies::NEW: {
         Indent indent;
         std::string odir = this->BinaryDirectory;
         cmSystemTools::ConvertToUnixSlashes(odir);

+ 0 - 5
Source/cmLinkDirectoriesCommand.cxx

@@ -67,11 +67,6 @@ static void AddLinkDir(cmMakefile& mf, std::string const& dir,
       case cmPolicies::OLD:
         // OLD behavior does not convert
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0015);
-        mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
-        CM_FALLTHROUGH;
       case cmPolicies::NEW:
         // NEW behavior converts
         convertToAbsolute = true;

+ 0 - 13
Source/cmListCommand.cxx

@@ -48,13 +48,6 @@ bool GetIndexArg(const std::string& arg, int* idx, cmMakefile& mf)
         break;
       case cmPolicies::NEW:
         return false;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        std::string msg =
-          cmStrCat(cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0121),
-                   " Invalid list index \"", arg, "\".");
-        mf.IssueMessage(MessageType::FATAL_ERROR, msg);
-        break;
     }
   }
 
@@ -118,12 +111,6 @@ cm::optional<cmList> GetList(const std::string& var,
       return list;
     case cmPolicies::NEW:
       return list;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
-      makefile.IssueMessage(
-        MessageType::FATAL_ERROR,
-        cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0007));
-      return {};
   }
   return list;
 }

+ 0 - 23
Source/cmLocalGenerator.cxx

@@ -754,8 +754,6 @@ void cmLocalGenerator::GenerateInstallRules()
       }
     } break;
 
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       // NEW behavior is handled in
       // cmInstallSubdirectoryGenerator::GenerateScript()
@@ -1997,12 +1995,6 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065(
         add_shlib_flags =
           !(tgt.IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS"));
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        this->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0065));
-        CM_FALLTHROUGH;
       case cmPolicies::NEW:
         // NEW behavior is to only add the flags if ENABLE_EXPORTS is on,
         // except on AIX where we compute symbol exports.
@@ -2605,8 +2597,6 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
         }
         case cmPolicies::OLD:
           return true;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
         case cmPolicies::NEW:
           return false;
       }
@@ -2740,13 +2730,6 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
     case cmPolicies::OLD:
       this->AppendFlags(flags, newFlags);
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
-      this->Makefile->GetCMakeInstance()->IssueMessage(
-        MessageType::FATAL_ERROR,
-        cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0181),
-        target->GetBacktrace());
-      CM_FALLTHROUGH;
     case cmPolicies::NEW:
       if (compileOrLink == cmBuildStep::Link) {
         std::vector<std::string> options;
@@ -4422,12 +4405,6 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
       break;
     case cmPolicies::NEW:
       // New behavior is to ignore the variable.
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
-      // This will never be the case because the only way to require
-      // the setting is to require the user to specify version policy
-      // 2.6 or higher.  Once we add that requirement then this whole
-      // method can be removed anyway.
       return false;
   }
 

+ 0 - 4
Source/cmLocalNinjaGenerator.cxx

@@ -730,8 +730,6 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
             CM_FALLTHROUGH;
           case cmPolicies::OLD:
             break;
-          case cmPolicies::REQUIRED_IF_USED:
-          case cmPolicies::REQUIRED_ALWAYS:
           case cmPolicies::NEW:
             depfile = ccg.GetInternalDepfile();
             break;
@@ -833,8 +831,6 @@ cmLocalNinjaGenerator::MakeCustomCommandGenerators(
       CM_FALLTHROUGH;
     case cmPolicies::OLD:
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       transformDepfile = true;
       break;

+ 3 - 62
Source/cmMakefile.cxx

@@ -211,8 +211,6 @@ bool cmMakefile::CheckCMP0037(std::string const& targetName,
     case cmPolicies::OLD:
       break;
     case cmPolicies::NEW:
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
       issueMessage = true;
       messageType = MessageType::FATAL_ERROR;
       break;
@@ -601,12 +599,6 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf,
         // OLD behavior is to not push a scope at all.
         this->NoPolicyScope = true;
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        // We should never make this policy required, but we handle it
-        // here just in case.
-        this->CheckCMP0011 = true;
-        CM_FALLTHROUGH;
       case cmPolicies::NEW:
         // NEW behavior is to push a (strong) scope.
         this->Makefile->PushPolicy();
@@ -664,17 +656,6 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
         this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e);
       }
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS: {
-      auto e = cmStrCat(
-        cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011),
-        "\n"
-        "The included script\n  ",
-        this->Makefile->GetBacktrace().Top().FilePath,
-        "\n"
-        "affects policy settings, so it requires this policy to be set.");
-      this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e);
-    } break;
     case cmPolicies::OLD:
     case cmPolicies::NEW:
       // The script set this policy.  We assume the purpose of the
@@ -980,8 +961,6 @@ void cmMakefile::EnforceDirectoryLevelRules() const
         // OLD behavior is to use policy version 2.4 set in
         // cmListFileCache.
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
       case cmPolicies::NEW:
         // NEW behavior is to issue an error.
         this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e,
@@ -1183,8 +1162,6 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
       case cmPolicies::OLD:
         break;
       case cmPolicies::NEW:
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
         issueMessage = true;
         messageType = MessageType::FATAL_ERROR;
         break;
@@ -1539,12 +1516,6 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
         // OLD behavior is to not escape the value.  We should not
         // convert the definition to use the property.
         return false;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        this->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0005));
-        return false;
       case cmPolicies::NEW:
         // NEW behavior is to escape the value.  Proceed to convert it
         // to an entry in the property.
@@ -1923,11 +1894,6 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf)
       case cmPolicies::OLD:
         // OLD behavior does not warn.
         break;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        e += cmStrCat('\n',
-                      cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0014));
-        CM_FALLTHROUGH;
       case cmPolicies::NEW:
         // NEW behavior prints the error.
         this->IssueMessage(MessageType::FATAL_ERROR, e);
@@ -2116,8 +2082,6 @@ void cmMakefile::AddCacheDefinition(const std::string& name, cmValue value,
       this->StateSnapshot.RemoveDefinition(name);
       break;
     case cmPolicies::NEW:
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
       break;
   }
 }
@@ -2790,8 +2754,6 @@ const std::string& cmMakefile::ExpandVariablesInString(
                                                noEscapes, atOnly, filename,
                                                line, removeEmpty, true);
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     // Messaging here would be *very* verbose.
     case cmPolicies::NEW:
       mtype = this->ExpandVariablesInStringNew(errorstr, source, escapeQuotes,
@@ -2937,11 +2899,6 @@ MessageType cmMakefile::ExpandVariablesInStringOld(
           // OLD behavior is to just warn and continue.
           mtype = MessageType::AUTHOR_WARNING;
           break;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
-          error += cmStrCat(
-            '\n', cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0010));
-          break;
         case cmPolicies::NEW:
           // NEW behavior is to report the error.
           break;
@@ -3962,8 +3919,6 @@ std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system,
           system = false;
           result = moduleInCMakeModulePath;
           break;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
         case cmPolicies::NEW:
           system = true;
           result = moduleInCMakeRoot;
@@ -4428,12 +4383,6 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
         CM_FALLTHROUGH;
       case cmPolicies::OLD:
         return true;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        this->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002));
-        return true;
       case cmPolicies::NEW:
         break;
     }
@@ -4518,11 +4467,6 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
     case cmPolicies::OLD:
       // OLD behavior does not warn.
       return true;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
-      e = cmStrCat(cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0013),
-                   '\n');
-      CM_FALLTHROUGH;
     case cmPolicies::NEW:
       // NEW behavior prints the error.
       e += cmStrCat("The binary directory\n"
@@ -4629,10 +4573,9 @@ bool cmMakefile::SetPolicy(const char* id, cmPolicies::PolicyStatus status)
 bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
                            cmPolicies::PolicyStatus status)
 {
-  // A REQUIRED_ALWAYS policy may be set only to NEW.
-  if (status != cmPolicies::NEW &&
-      cmPolicies::GetPolicyStatus(id) == cmPolicies::REQUIRED_ALWAYS) {
-    std::string msg = cmPolicies::GetRequiredAlwaysPolicyError(id);
+  // A removed policy may be set only to NEW.
+  if (cmPolicies::IsRemoved(id) && status != cmPolicies::NEW) {
+    std::string msg = cmPolicies::GetRemovedPolicyError(id);
     this->IssueMessage(MessageType::FATAL_ERROR, msg);
     return false;
   }
@@ -4743,8 +4686,6 @@ bool cmMakefile::IgnoreErrorsCMP0061() const
       CM_FALLTHROUGH;
     case cmPolicies::OLD:
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       ignoreErrors = false;
       break;

+ 0 - 2
Source/cmMakefileTargetGenerator.cxx

@@ -75,8 +75,6 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
       this->CMP0113New = false;
       break;
     case cmPolicies::NEW:
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
       this->CMP0113New = true;
       break;
   }

+ 0 - 2
Source/cmMarkAsAdvancedCommand.cxx

@@ -54,8 +54,6 @@ bool cmMarkAsAdvancedCommand(std::vector<std::string> const& args,
         oldBehavior = true;
         break;
       case cmPolicies::NEW:
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
         if (!state->GetCacheEntryValue(variable)) {
           ignoreVariable = true;
         }

+ 0 - 2
Source/cmNinjaTargetGenerator.cxx

@@ -1060,8 +1060,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
         case cmPolicies::WARN:
         case cmPolicies::OLD:
           break;
-        case cmPolicies::REQUIRED_ALWAYS:
-        case cmPolicies::REQUIRED_IF_USED:
         case cmPolicies::NEW:
           usePrivateGeneratedSources = true;
           break;

+ 0 - 2
Source/cmOptionCommand.cxx

@@ -38,8 +38,6 @@ bool cmOptionCommand(std::vector<std::string> const& args,
       case cmPolicies::OLD:
         // OLD behavior does not warn.
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::NEW: {
         // See if a local variable with this name already exists.
         // If so we ignore the option command.

+ 27 - 28
Source/cmPolicies.cxx

@@ -1,3 +1,5 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmPolicies.h"
 
 #include <cassert>
@@ -55,6 +57,10 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
 #define CM_FOR_EACH_POLICY_ID_DOC(POLICY)                                     \
   CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_DOC)
 
+#define CM_SELECT_ID_STATUS(F, A1, A2, A3, A4, A5, A6) F(A1, A6)
+#define CM_FOR_EACH_POLICY_ID_STATUS(POLICY)                                  \
+  CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_STATUS)
+
 static const char* idToString(cmPolicies::PolicyID id)
 {
   switch (id) {
@@ -117,6 +123,23 @@ static const char* idToShortDescription(cmPolicies::PolicyID id)
   return nullptr;
 }
 
+namespace {
+cmPolicies::PolicyStatus idToStatus(cmPolicies::PolicyID id)
+{
+  switch (id) {
+#define POLICY_CASE(ID, STATUS)                                               \
+  case cmPolicies::ID:                                                        \
+    return cmPolicies::STATUS;
+    // NOLINTNEXTLINE(bugprone-branch-clone)
+    CM_FOR_EACH_POLICY_ID_STATUS(POLICY_CASE)
+#undef POLICY_CASE
+    case cmPolicies::CMPCOUNT:
+      break;
+  }
+  return cmPolicies::WARN;
+}
+}
+
 static void DiagnoseAncientPolicies(
   std::vector<cmPolicies::PolicyID> const& ancient, unsigned int majorVer,
   unsigned int minorVer, unsigned int patchVer, cmMakefile* mf)
@@ -282,7 +305,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
   for (PolicyID pid = cmPolicies::CMP0000; pid != cmPolicies::CMPCOUNT;
        pid = static_cast<PolicyID>(pid + 1)) {
     if (isPolicyNewerThan(pid, majorVer, minorVer, patchVer)) {
-      if (cmPolicies::GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS) {
+      if (cmPolicies::IsRemoved(pid)) {
         ancientPolicies.push_back(pid);
       } else {
         cmPolicies::PolicyStatus status = cmPolicies::WARN;
@@ -353,36 +376,12 @@ std::string cmPolicies::GetPolicyDeprecatedWarning(cmPolicies::PolicyID id)
     "to the NEW behavior and not rely on setting a policy to OLD.");
 }
 
-//! return an error string for when a required policy is unspecified
-std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
+bool cmPolicies::IsRemoved(cmPolicies::PolicyID id)
 {
-  return cmStrCat(
-    "Policy ", idToString(id),
-    " is not set to NEW: ", idToShortDescription(id),
-    "  "
-    "Run \"cmake --help-policy ",
-    idToString(id),
-    "\" for policy details.  "
-    "CMake now requires this policy to be set to NEW by the project.  "
-    "The policy may be set explicitly using the code\n"
-    "  cmake_policy(SET ",
-    idToString(id),
-    " NEW)\n"
-    "or by upgrading all policies with the code\n"
-    "  cmake_policy(VERSION ",
-    idToVersion(id),
-    ") # or later\n"
-    "Run \"cmake --help-command cmake_policy\" for more information.");
-}
-
-//! Get the default status for a policy
-cmPolicies::PolicyStatus cmPolicies::GetPolicyStatus(
-  cmPolicies::PolicyID /*unused*/)
-{
-  return cmPolicies::WARN;
+  return idToStatus(id) == cmPolicies::NEW;
 }
 
-std::string cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
+std::string cmPolicies::GetRemovedPolicyError(cmPolicies::PolicyID id)
 {
   std::string pid = idToString(id);
   return cmStrCat(

+ 189 - 203
Source/cmPolicies.h

@@ -9,553 +9,546 @@
 
 class cmMakefile;
 
+// Each policy has a short description, the version of CMake in which
+// it was introduced, and its default status.  The status is WARN for
+// existing policies and NEW for removed policies.
+
 #define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT)                              \
   SELECT(POLICY, CMP0000,                                                     \
          "A minimum required CMake version must be specified.", 2, 6, 0,      \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0001,                                                     \
          "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", 2, 6, 0,  \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0002, "Logical target names must be globally unique.", 2, \
-         6, 0, cmPolicies::WARN)                                              \
+         6, 0, WARN)                                                          \
   SELECT(                                                                     \
     POLICY, CMP0003,                                                          \
     "Libraries linked via full path no longer produce linker search paths.",  \
-    2, 6, 0, cmPolicies::WARN)                                                \
+    2, 6, 0, WARN)                                                            \
   SELECT(POLICY, CMP0004,                                                     \
          "Libraries linked may not have leading or trailing whitespace.", 2,  \
-         6, 0, cmPolicies::WARN)                                              \
+         6, 0, WARN)                                                          \
   SELECT(POLICY, CMP0005,                                                     \
          "Preprocessor definition values are now escaped automatically.", 2,  \
-         6, 0, cmPolicies::WARN)                                              \
+         6, 0, WARN)                                                          \
   SELECT(POLICY, CMP0006,                                                     \
          "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.",   \
-         2, 6, 0, cmPolicies::WARN)                                           \
+         2, 6, 0, WARN)                                                       \
   SELECT(POLICY, CMP0007, "list command no longer ignores empty elements.",   \
-         2, 6, 0, cmPolicies::WARN)                                           \
+         2, 6, 0, WARN)                                                       \
   SELECT(                                                                     \
     POLICY, CMP0008,                                                          \
     "Libraries linked by full-path must have a valid library file name.", 2,  \
-    6, 1, cmPolicies::WARN)                                                   \
+    6, 1, WARN)                                                               \
   SELECT(POLICY, CMP0009,                                                     \
          "FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \
-         6, 2, cmPolicies::WARN)                                              \
+         6, 2, WARN)                                                          \
   SELECT(POLICY, CMP0010, "Bad variable reference syntax is an error.", 2, 6, \
-         3, cmPolicies::WARN)                                                 \
+         3, WARN)                                                             \
   SELECT(POLICY, CMP0011,                                                     \
          "Included scripts do automatic cmake_policy PUSH and POP.", 2, 6, 3, \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0012, "if() recognizes numbers and boolean constants.",   \
-         2, 8, 0, cmPolicies::WARN)                                           \
+         2, 8, 0, WARN)                                                       \
   SELECT(POLICY, CMP0013, "Duplicate binary directories are not allowed.", 2, \
-         8, 0, cmPolicies::WARN)                                              \
+         8, 0, WARN)                                                          \
   SELECT(POLICY, CMP0014, "Input directories must have CMakeLists.txt.", 2,   \
-         8, 0, cmPolicies::WARN)                                              \
+         8, 0, WARN)                                                          \
   SELECT(POLICY, CMP0015,                                                     \
          "link_directories() treats paths relative to the source dir.", 2, 8, \
-         1, cmPolicies::WARN)                                                 \
+         1, WARN)                                                             \
   SELECT(POLICY, CMP0016,                                                     \
          "target_link_libraries() reports error if its only argument "        \
          "is not a target.",                                                  \
-         2, 8, 3, cmPolicies::WARN)                                           \
+         2, 8, 3, WARN)                                                       \
   SELECT(POLICY, CMP0017,                                                     \
          "Prefer files from the CMake module directory when including from "  \
          "there.",                                                            \
-         2, 8, 4, cmPolicies::WARN)                                           \
+         2, 8, 4, WARN)                                                       \
   SELECT(POLICY, CMP0018,                                                     \
-         "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", 2, 8, 9,       \
-         cmPolicies::WARN)                                                    \
+         "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", 2, 8, 9, WARN) \
   SELECT(POLICY, CMP0019,                                                     \
          "Do not re-expand variables in include and link information.", 2, 8, \
-         11, cmPolicies::WARN)                                                \
+         11, WARN)                                                            \
   SELECT(POLICY, CMP0020,                                                     \
          "Automatically link Qt executables to qtmain target on Windows.", 2, \
-         8, 11, cmPolicies::WARN)                                             \
+         8, 11, WARN)                                                         \
   SELECT(                                                                     \
     POLICY, CMP0021,                                                          \
     "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.",  \
-    2, 8, 12, cmPolicies::WARN)                                               \
+    2, 8, 12, WARN)                                                           \
   SELECT(POLICY, CMP0022,                                                     \
          "INTERFACE_LINK_LIBRARIES defines the link interface.", 2, 8, 12,    \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(                                                                     \
     POLICY, CMP0023,                                                          \
     "Plain and keyword target_link_libraries signatures cannot be mixed.", 2, \
-    8, 12, cmPolicies::WARN)                                                  \
-  SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0,         \
-         cmPolicies::WARN)                                                    \
+    8, 12, WARN)                                                              \
+  SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0, WARN)   \
   SELECT(POLICY, CMP0025, "Compiler id for Apple Clang is now AppleClang.",   \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0026, "Disallow use of the LOCATION target property.", 3, \
-         0, 0, cmPolicies::WARN)                                              \
+         0, 0, WARN)                                                          \
   SELECT(POLICY, CMP0027,                                                     \
          "Conditionally linked imported targets with missing include "        \
          "directories.",                                                      \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0028,                                                     \
          "Double colon in target name means ALIAS or IMPORTED target.", 3, 0, \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0029, "The subdir_depends command should not be called.", \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0030,                                                     \
-         "The use_mangled_mesa command should not be called.", 3, 0, 0,       \
-         cmPolicies::WARN)                                                    \
+         "The use_mangled_mesa command should not be called.", 3, 0, 0, WARN) \
   SELECT(POLICY, CMP0031, "The load_command command should not be called.",   \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0032,                                                     \
          "The output_required_files command should not be called.", 3, 0, 0,  \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0033,                                                     \
          "The export_library_dependencies command should not be called.", 3,  \
-         0, 0, cmPolicies::WARN)                                              \
+         0, 0, WARN)                                                          \
   SELECT(POLICY, CMP0034, "The utility_source command should not be called.", \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0035,                                                     \
          "The variable_requires command should not be called.", 3, 0, 0,      \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0036, "The build_name command should not be called.", 3,  \
-         0, 0, cmPolicies::WARN)                                              \
+         0, 0, WARN)                                                          \
   SELECT(POLICY, CMP0037,                                                     \
          "Target names should not be reserved and should match a validity "   \
          "pattern.",                                                          \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0038, "Targets may not link directly to themselves.", 3,  \
-         0, 0, cmPolicies::WARN)                                              \
+         0, 0, WARN)                                                          \
   SELECT(POLICY, CMP0039, "Utility targets may not have link dependencies.",  \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0040,                                                     \
          "The target in the TARGET signature of add_custom_command() must "   \
          "exist and must be defined in the current directory.",               \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0041,                                                     \
          "Error on relative include with generator expression.", 3, 0, 0,     \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0042, "MACOSX_RPATH is enabled by default.", 3, 0, 0,     \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0043, "Ignore COMPILE_DEFINITIONS_<Config> properties.",  \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0044,                                                     \
          "Case sensitive <LANG>_COMPILER_ID generator expressions.", 3, 0, 0, \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0045,                                                     \
          "Error on non-existent target in get_target_property.", 3, 0, 0,     \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0046,                                                     \
          "Error on non-existent dependency in add_dependencies.", 3, 0, 0,    \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0047, "Use QCC compiler id for the qcc drivers on QNX.",  \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0048, "project() command manages VERSION variables.", 3,  \
-         0, 0, cmPolicies::WARN)                                              \
+         0, 0, WARN)                                                          \
   SELECT(POLICY, CMP0049,                                                     \
-         "Do not expand variables in target source entries.", 3, 0, 0,        \
-         cmPolicies::WARN)                                                    \
+         "Do not expand variables in target source entries.", 3, 0, 0, WARN)  \
   SELECT(POLICY, CMP0050, "Disallow add_custom_command SOURCE signatures.",   \
-         3, 0, 0, cmPolicies::WARN)                                           \
+         3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0051, "List TARGET_OBJECTS in SOURCES target property.",  \
-         3, 1, 0, cmPolicies::WARN)                                           \
+         3, 1, 0, WARN)                                                       \
   SELECT(POLICY, CMP0052,                                                     \
          "Reject source and build dirs in installed "                         \
          "INTERFACE_INCLUDE_DIRECTORIES.",                                    \
-         3, 1, 0, cmPolicies::WARN)                                           \
+         3, 1, 0, WARN)                                                       \
   SELECT(POLICY, CMP0053,                                                     \
          "Simplify variable reference and escape sequence evaluation.", 3, 1, \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(                                                                     \
     POLICY, CMP0054,                                                          \
     "Only interpret if() arguments as variables or keywords when unquoted.",  \
-    3, 1, 0, cmPolicies::WARN)                                                \
+    3, 1, 0, WARN)                                                            \
   SELECT(POLICY, CMP0055, "Strict checking for break() command.", 3, 2, 0,    \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0056,                                                     \
          "Honor link flags in try_compile() source-file signature.", 3, 2, 0, \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0057, "Support new IN_LIST if() operator.", 3, 3, 0,      \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0058,                                                     \
          "Ninja requires custom command byproducts to be explicit.", 3, 3, 0, \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0059,                                                     \
          "Do not treat DEFINITIONS as a built-in directory property.", 3, 3,  \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0060,                                                     \
          "Link libraries by full path even in implicit directories.", 3, 3,   \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0061,                                                     \
          "CTest does not by default tell make to ignore errors (-i).", 3, 3,  \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0062, "Disallow install() of export() result.", 3, 3, 0,  \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0063,                                                     \
-         "Honor visibility properties for all target types.", 3, 3, 0,        \
-         cmPolicies::WARN)                                                    \
-  SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0,         \
-         cmPolicies::WARN)                                                    \
+         "Honor visibility properties for all target types.", 3, 3, 0, WARN)  \
+  SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, WARN)   \
   SELECT(POLICY, CMP0065,                                                     \
          "Do not add flags to export symbols from executables without "       \
          "the ENABLE_EXPORTS target property.",                               \
-         3, 4, 0, cmPolicies::WARN)                                           \
+         3, 4, 0, WARN)                                                       \
   SELECT(POLICY, CMP0066,                                                     \
          "Honor per-config flags in try_compile() source-file signature.", 3, \
-         7, 0, cmPolicies::WARN)                                              \
+         7, 0, WARN)                                                          \
   SELECT(POLICY, CMP0067,                                                     \
          "Honor language standard in try_compile() source-file signature.",   \
-         3, 8, 0, cmPolicies::WARN)                                           \
+         3, 8, 0, WARN)                                                       \
   SELECT(POLICY, CMP0068,                                                     \
          "RPATH settings on macOS do not affect install_name.", 3, 9, 0,      \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0069,                                                     \
          "INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.", 3, 9, 0,   \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0070,                                                     \
          "Define file(GENERATE) behavior for relative paths.", 3, 10, 0,      \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0071, "Let AUTOMOC and AUTOUIC process GENERATED files.", \
-         3, 10, 0, cmPolicies::WARN)                                          \
+         3, 10, 0, WARN)                                                      \
   SELECT(POLICY, CMP0072,                                                     \
          "FindOpenGL prefers GLVND by default when available.", 3, 11, 0,     \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0073,                                                     \
-         "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0,       \
-         cmPolicies::WARN)                                                    \
+         "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, WARN) \
   SELECT(POLICY, CMP0074, "find_package uses <PackageName>_ROOT variables.",  \
-         3, 12, 0, cmPolicies::WARN)                                          \
+         3, 12, 0, WARN)                                                      \
   SELECT(POLICY, CMP0075,                                                     \
          "Include file check macros honor CMAKE_REQUIRED_LIBRARIES.", 3, 12,  \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0076,                                                     \
          "target_sources() command converts relative paths to absolute.", 3,  \
-         13, 0, cmPolicies::WARN)                                             \
+         13, 0, WARN)                                                         \
   SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0,      \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0078, "UseSWIG generates standard target names.", 3, 13,  \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(                                                                     \
     POLICY, CMP0079,                                                          \
     "target_link_libraries allows use with targets in other directories.", 3, \
-    13, 0, cmPolicies::WARN)                                                  \
+    13, 0, WARN)                                                              \
   SELECT(POLICY, CMP0080,                                                     \
          "BundleUtilities cannot be included at configure time.", 3, 13, 0,   \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0081,                                                     \
          "Relative paths not allowed in LINK_DIRECTORIES target property.",   \
-         3, 13, 0, cmPolicies::WARN)                                          \
+         3, 13, 0, WARN)                                                      \
   SELECT(POLICY, CMP0082,                                                     \
          "Install rules from add_subdirectory() are interleaved with those "  \
          "in caller.",                                                        \
-         3, 14, 0, cmPolicies::WARN)                                          \
+         3, 14, 0, WARN)                                                      \
   SELECT(POLICY, CMP0083, "Add PIE options when linking executable.", 3, 14,  \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0084,                                                     \
          "The FindQt module does not exist for find_package().", 3, 14, 0,    \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0085, "$<IN_LIST:...> handles empty list items.", 3, 14,  \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0086,                                                     \
-         "UseSWIG honors SWIG_MODULE_NAME via -module flag.", 3, 14, 0,       \
-         cmPolicies::WARN)                                                    \
+         "UseSWIG honors SWIG_MODULE_NAME via -module flag.", 3, 14, 0, WARN) \
   SELECT(POLICY, CMP0087,                                                     \
          "Install CODE|SCRIPT allow the use of generator "                    \
          "expressions.",                                                      \
-         3, 14, 0, cmPolicies::WARN)                                          \
+         3, 14, 0, WARN)                                                      \
   SELECT(POLICY, CMP0088,                                                     \
          "FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing.",  \
-         3, 14, 0, cmPolicies::WARN)                                          \
+         3, 14, 0, WARN)                                                      \
   SELECT(POLICY, CMP0089,                                                     \
          "Compiler id for IBM Clang-based XL compilers is now XLClang.", 3,   \
-         15, 0, cmPolicies::WARN)                                             \
+         15, 0, WARN)                                                         \
   SELECT(POLICY, CMP0090,                                                     \
          "export(PACKAGE) does not populate package registry by default.", 3, \
-         15, 0, cmPolicies::WARN)                                             \
+         15, 0, WARN)                                                         \
   SELECT(POLICY, CMP0091,                                                     \
          "MSVC runtime library flags are selected by an abstraction.", 3, 15, \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0092,                                                     \
          "MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.", 3,   \
-         15, 0, cmPolicies::WARN)                                             \
+         15, 0, WARN)                                                         \
   SELECT(POLICY, CMP0093, "FindBoost reports Boost_VERSION in x.y.z format.", \
-         3, 15, 0, cmPolicies::WARN)                                          \
+         3, 15, 0, WARN)                                                      \
   SELECT(POLICY, CMP0094,                                                     \
          "FindPython3,  FindPython2 and FindPyton use "                       \
          "LOCATION for lookup strategy.",                                     \
-         3, 15, 0, cmPolicies::WARN)                                          \
+         3, 15, 0, WARN)                                                      \
   SELECT(POLICY, CMP0095,                                                     \
          "RPATH entries are properly escaped in the intermediary CMake "      \
          "install script.",                                                   \
-         3, 16, 0, cmPolicies::WARN)                                          \
+         3, 16, 0, WARN)                                                      \
   SELECT(POLICY, CMP0096,                                                     \
          "project() preserves leading zeros in version components.", 3, 16,   \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0097,                                                     \
          "ExternalProject_Add with GIT_SUBMODULES \"\" initializes no "       \
          "submodules.",                                                       \
-         3, 16, 0, cmPolicies::WARN)                                          \
+         3, 16, 0, WARN)                                                      \
   SELECT(POLICY, CMP0098,                                                     \
          "FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing.", 3, \
-         17, 0, cmPolicies::WARN)                                             \
+         17, 0, WARN)                                                         \
   SELECT(POLICY, CMP0099,                                                     \
          "Link properties are transitive over private dependencies of "       \
          "static libraries.",                                                 \
-         3, 17, 0, cmPolicies::WARN)                                          \
+         3, 17, 0, WARN)                                                      \
   SELECT(POLICY, CMP0100, "Let AUTOMOC and AUTOUIC process .hh files.", 3,    \
-         17, 0, cmPolicies::WARN)                                             \
+         17, 0, WARN)                                                         \
   SELECT(POLICY, CMP0101,                                                     \
          "target_compile_options honors BEFORE keyword in all scopes.", 3,    \
-         17, 0, cmPolicies::WARN)                                             \
+         17, 0, WARN)                                                         \
   SELECT(POLICY, CMP0102,                                                     \
          "mark_as_advanced() does nothing if a cache entry does not exist.",  \
-         3, 17, 0, cmPolicies::WARN)                                          \
+         3, 17, 0, WARN)                                                      \
   SELECT(POLICY, CMP0103,                                                     \
          "Multiple export() with same FILE without APPEND is not allowed.",   \
-         3, 18, 0, cmPolicies::WARN)                                          \
+         3, 18, 0, WARN)                                                      \
   SELECT(POLICY, CMP0104,                                                     \
          "CMAKE_CUDA_ARCHITECTURES now detected for NVCC, empty "             \
          "CUDA_ARCHITECTURES not allowed.",                                   \
-         3, 18, 0, cmPolicies::WARN)                                          \
+         3, 18, 0, WARN)                                                      \
   SELECT(POLICY, CMP0105, "Device link step uses the link options.", 3, 18,   \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0106, "The Documentation module is removed.", 3, 18, 0,   \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0107, "An ALIAS target cannot overwrite another target.", \
-         3, 18, 0, cmPolicies::WARN)                                          \
+         3, 18, 0, WARN)                                                      \
   SELECT(POLICY, CMP0108, "A target cannot link to itself through an alias.", \
-         3, 18, 0, cmPolicies::WARN)                                          \
+         3, 18, 0, WARN)                                                      \
   SELECT(POLICY, CMP0109,                                                     \
          "find_program() requires permission to execute but not to read.", 3, \
-         19, 0, cmPolicies::WARN)                                             \
+         19, 0, WARN)                                                         \
   SELECT(POLICY, CMP0110,                                                     \
          "add_test() supports arbitrary characters in test names.", 3, 19, 0, \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0111,                                                     \
          "An imported target missing its location property fails during "     \
          "generation.",                                                       \
-         3, 19, 0, cmPolicies::WARN)                                          \
+         3, 19, 0, WARN)                                                      \
   SELECT(POLICY, CMP0112,                                                     \
          "Target file component generator expressions do not add target "     \
          "dependencies.",                                                     \
-         3, 19, 0, cmPolicies::WARN)                                          \
+         3, 19, 0, WARN)                                                      \
   SELECT(POLICY, CMP0113,                                                     \
          "Makefile generators do not repeat custom commands from target "     \
          "dependencies.",                                                     \
-         3, 19, 0, cmPolicies::WARN)                                          \
+         3, 19, 0, WARN)                                                      \
   SELECT(POLICY, CMP0114,                                                     \
          "ExternalProject step targets fully adopt their steps.", 3, 19, 0,   \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0115, "Source file extensions must be explicit.", 3, 20,  \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0116,                                                     \
          "Ninja generators transform DEPFILEs from add_custom_command().", 3, \
-         20, 0, cmPolicies::WARN)                                             \
+         20, 0, WARN)                                                         \
   SELECT(POLICY, CMP0117,                                                     \
          "MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.", 3, \
-         20, 0, cmPolicies::WARN)                                             \
+         20, 0, WARN)                                                         \
   SELECT(POLICY, CMP0118,                                                     \
          "GENERATED sources may be used across directories without manual "   \
          "marking.",                                                          \
-         3, 20, 0, cmPolicies::WARN)                                          \
+         3, 20, 0, WARN)                                                      \
   SELECT(POLICY, CMP0119,                                                     \
          "LANGUAGE source file property explicitly compiles as specified "    \
          "language.",                                                         \
-         3, 20, 0, cmPolicies::WARN)                                          \
+         3, 20, 0, WARN)                                                      \
   SELECT(POLICY, CMP0120,                                                     \
          "The WriteCompilerDetectionHeader module is removed.", 3, 20, 0,     \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0121,                                                     \
          "The list() command now validates parsing of index arguments.", 3,   \
-         21, 0, cmPolicies::WARN)                                             \
+         21, 0, WARN)                                                         \
   SELECT(                                                                     \
     POLICY, CMP0122,                                                          \
     "UseSWIG use standard library name conventions for csharp language.", 3,  \
-    21, 0, cmPolicies::WARN)                                                  \
+    21, 0, WARN)                                                              \
   SELECT(POLICY, CMP0123,                                                     \
          "ARMClang cpu/arch compile and link flags must be set explicitly.",  \
-         3, 21, 0, cmPolicies::WARN)                                          \
+         3, 21, 0, WARN)                                                      \
   SELECT(POLICY, CMP0124,                                                     \
          "foreach() loop variables are only available in the loop scope.", 3, \
-         21, 0, cmPolicies::WARN)                                             \
+         21, 0, WARN)                                                         \
   SELECT(POLICY, CMP0125,                                                     \
          "find_(path|file|library|program) have consistent behavior for "     \
          "cache variables.",                                                  \
-         3, 21, 0, cmPolicies::WARN)                                          \
+         3, 21, 0, WARN)                                                      \
   SELECT(POLICY, CMP0126,                                                     \
          "set(CACHE) does not remove a normal variable of the same name.", 3, \
-         21, 0, cmPolicies::WARN)                                             \
+         21, 0, WARN)                                                         \
   SELECT(POLICY, CMP0127,                                                     \
          "cmake_dependent_option() supports full Condition Syntax.", 3, 22,   \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0128,                                                     \
          "Selection of language standard and extension flags improved.", 3,   \
-         22, 0, cmPolicies::WARN)                                             \
+         22, 0, WARN)                                                         \
   SELECT(POLICY, CMP0129,                                                     \
          "Compiler id for MCST LCC compilers is now LCC, not GNU.", 3, 23, 0, \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0130, "while() diagnoses condition evaluation errors.",   \
-         3, 24, 0, cmPolicies::WARN)                                          \
+         3, 24, 0, WARN)                                                      \
   SELECT(POLICY, CMP0131,                                                     \
          "LINK_LIBRARIES supports the LINK_ONLY generator expression.", 3,    \
-         24, 0, cmPolicies::WARN)                                             \
+         24, 0, WARN)                                                         \
   SELECT(POLICY, CMP0132,                                                     \
          "Do not set compiler environment variables on first run", 3, 24, 0,  \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0133,                                                     \
          "The CPack module disables SLA by default in the CPack DragNDrop "   \
          "Generator.",                                                        \
-         3, 24, 0, cmPolicies::WARN)                                          \
+         3, 24, 0, WARN)                                                      \
   SELECT(POLICY, CMP0134,                                                     \
          "Fallback to \"HOST\" Windows registry view when \"TARGET\" view "   \
          "is not usable.",                                                    \
-         3, 24, 0, cmPolicies::WARN)                                          \
+         3, 24, 0, WARN)                                                      \
   SELECT(POLICY, CMP0135,                                                     \
          "ExternalProject and FetchContent ignore timestamps in archives by " \
          "default for the URL download method",                               \
-         3, 24, 0, cmPolicies::WARN)                                          \
+         3, 24, 0, WARN)                                                      \
   SELECT(POLICY, CMP0136,                                                     \
          "Watcom runtime library flags are selected by an abstraction.", 3,   \
-         24, 0, cmPolicies::WARN)                                             \
+         24, 0, WARN)                                                         \
   SELECT(POLICY, CMP0137,                                                     \
          "try_compile() passes platform variables in project mode", 3, 24, 0, \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0138,                                                     \
          "CheckIPOSupported uses flags from calling project.", 3, 24, 0,      \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(                                                                     \
     POLICY, CMP0139,                                                          \
     "The if() command supports path comparisons using PATH_EQUAL operator.",  \
-    3, 24, 0, cmPolicies::WARN)                                               \
+    3, 24, 0, WARN)                                                           \
   SELECT(POLICY, CMP0140, "The return() command checks its arguments.", 3,    \
-         25, 0, cmPolicies::WARN)                                             \
+         25, 0, WARN)                                                         \
   SELECT(                                                                     \
     POLICY, CMP0141,                                                          \
     "MSVC debug information format flags are selected by an abstraction.", 3, \
-    25, 0, cmPolicies::WARN)                                                  \
+    25, 0, WARN)                                                              \
   SELECT(POLICY, CMP0142,                                                     \
          "The Xcode generator does not append per-config suffixes to "        \
          "library search paths.",                                             \
-         3, 25, 0, cmPolicies::WARN)                                          \
+         3, 25, 0, WARN)                                                      \
   SELECT(POLICY, CMP0143,                                                     \
          "Global property USE_FOLDERS treated as ON by default", 3, 26, 0,    \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0144,                                                     \
          "find_package uses upper-case <PACKAGENAME>_ROOT variables.", 3, 27, \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0145, "The Dart and FindDart modules are removed.", 3,    \
-         27, 0, cmPolicies::WARN)                                             \
-  SELECT(POLICY, CMP0146, "The FindCUDA module is removed.", 3, 27, 0,        \
-         cmPolicies::WARN)                                                    \
+         27, 0, WARN)                                                         \
+  SELECT(POLICY, CMP0146, "The FindCUDA module is removed.", 3, 27, 0, WARN)  \
   SELECT(POLICY, CMP0147,                                                     \
          "Visual Studio generators build custom commands in parallel.", 3,    \
-         27, 0, cmPolicies::WARN)                                             \
+         27, 0, WARN)                                                         \
   SELECT(POLICY, CMP0148,                                                     \
          "The FindPythonInterp and FindPythonLibs modules are removed.", 3,   \
-         27, 0, cmPolicies::WARN)                                             \
+         27, 0, WARN)                                                         \
   SELECT(POLICY, CMP0149,                                                     \
          "Visual Studio generators select latest Windows SDK by default.", 3, \
-         27, 0, cmPolicies::WARN)                                             \
+         27, 0, WARN)                                                         \
   SELECT(POLICY, CMP0150,                                                     \
          "ExternalProject_Add and FetchContent_Declare commands "             \
          "treat relative GIT_REPOSITORY paths as being relative "             \
          "to the parent project's remote.",                                   \
-         3, 27, 0, cmPolicies::WARN)                                          \
+         3, 27, 0, WARN)                                                      \
   SELECT(POLICY, CMP0151,                                                     \
          "AUTOMOC include directory is a system include directory by "        \
          "default.",                                                          \
-         3, 27, 0, cmPolicies::WARN)                                          \
+         3, 27, 0, WARN)                                                      \
   SELECT(                                                                     \
     POLICY, CMP0152,                                                          \
     "file(REAL_PATH) resolves symlinks before collapsing ../ components.", 3, \
-    28, 0, cmPolicies::WARN)                                                  \
+    28, 0, WARN)                                                              \
   SELECT(POLICY, CMP0153, "The exec_program command should not be called.",   \
-         3, 28, 0, cmPolicies::WARN)                                          \
+         3, 28, 0, WARN)                                                      \
   SELECT(                                                                     \
     POLICY, CMP0154,                                                          \
     "Generated files are private by default in targets using file sets.", 3,  \
-    28, 0, cmPolicies::WARN)                                                  \
+    28, 0, WARN)                                                              \
   SELECT(POLICY, CMP0155,                                                     \
          "C++ sources in targets with at least C++20 are scanned for "        \
          "imports when supported.",                                           \
-         3, 28, 0, cmPolicies::WARN)                                          \
+         3, 28, 0, WARN)                                                      \
   SELECT(                                                                     \
     POLICY, CMP0156,                                                          \
     "De-duplicate libraries on link lines based on linker capabilities.", 3,  \
-    29, 0, cmPolicies::WARN)                                                  \
+    29, 0, WARN)                                                              \
   SELECT(POLICY, CMP0157,                                                     \
          "Swift compilation mode selected by an abstraction.", 3, 29, 0,      \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0158,                                                     \
          "add_test() honors CMAKE_CROSSCOMPILING_EMULATOR only when "         \
          "cross-compiling.",                                                  \
-         3, 29, 0, cmPolicies::WARN)                                          \
+         3, 29, 0, WARN)                                                      \
   SELECT(POLICY, CMP0159,                                                     \
-         "file(STRINGS) with REGEX updates CMAKE_MATCH_<n>.", 3, 29, 0,       \
-         cmPolicies::WARN)                                                    \
+         "file(STRINGS) with REGEX updates CMAKE_MATCH_<n>.", 3, 29, 0, WARN) \
   SELECT(                                                                     \
     POLICY, CMP0160,                                                          \
     "More read-only target properties now error when trying to set them.", 3, \
-    29, 0, cmPolicies::WARN)                                                  \
+    29, 0, WARN)                                                              \
   SELECT(POLICY, CMP0161, "CPACK_PRODUCTBUILD_DOMAINS defaults to true.", 3,  \
-         29, 0, cmPolicies::WARN)                                             \
+         29, 0, WARN)                                                         \
   SELECT(                                                                     \
     POLICY, CMP0162,                                                          \
     "Visual Studio generators add UseDebugLibraries indicators by default.",  \
-    3, 30, 0, cmPolicies::WARN)                                               \
+    3, 30, 0, WARN)                                                           \
   SELECT(                                                                     \
     POLICY, CMP0163,                                                          \
     "The GENERATED source file property is now visible in all directories.",  \
-    3, 30, 0, cmPolicies::WARN)                                               \
+    3, 30, 0, WARN)                                                           \
   SELECT(POLICY, CMP0164,                                                     \
          "add_library() rejects SHARED libraries when not supported by the "  \
          "platform.",                                                         \
-         3, 30, 0, cmPolicies::WARN)                                          \
+         3, 30, 0, WARN)                                                      \
   SELECT(POLICY, CMP0165,                                                     \
          "enable_language() must not be called before project().", 3, 30, 0,  \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0166,                                                     \
          "TARGET_PROPERTY evaluates link properties transitively over "       \
          "private dependencies of static libraries.",                         \
-         3, 30, 0, cmPolicies::WARN)                                          \
-  SELECT(POLICY, CMP0167, "The FindBoost module is removed.", 3, 30, 0,       \
-         cmPolicies::WARN)                                                    \
+         3, 30, 0, WARN)                                                      \
+  SELECT(POLICY, CMP0167, "The FindBoost module is removed.", 3, 30, 0, WARN) \
   SELECT(POLICY, CMP0168,                                                     \
          "FetchContent implements steps directly instead of through a "       \
          "sub-build.",                                                        \
-         3, 30, 0, cmPolicies::WARN)                                          \
+         3, 30, 0, WARN)                                                      \
   SELECT(POLICY, CMP0169,                                                     \
          "FetchContent_Populate(depName) single-argument signature is "       \
          "deprecated.",                                                       \
-         3, 30, 0, cmPolicies::WARN)                                          \
+         3, 30, 0, WARN)                                                      \
   SELECT(POLICY, CMP0170,                                                     \
          "FETCHCONTENT_FULLY_DISCONNECTED requirements are enforced.", 3, 30, \
-         0, cmPolicies::WARN)                                                 \
+         0, WARN)                                                             \
   SELECT(POLICY, CMP0171, "'codegen' is a reserved target name.", 3, 31, 0,   \
-         cmPolicies::WARN)                                                    \
+         WARN)                                                                \
   SELECT(POLICY, CMP0172,                                                     \
          "The CPack module enables per-machine installation by default in "   \
          "the CPack WIX Generator.",                                          \
-         3, 31, 0, cmPolicies::WARN)                                          \
+         3, 31, 0, WARN)                                                      \
   SELECT(POLICY, CMP0173, "The CMakeFindFrameworks module is removed.", 3,    \
-         31, 0, cmPolicies::WARN)                                             \
+         31, 0, WARN)                                                         \
   SELECT(POLICY, CMP0174,                                                     \
          "cmake_parse_arguments(PARSE_ARGV) defines a variable for an empty " \
          "string after a single-value keyword.",                              \
-         3, 31, 0, cmPolicies::WARN)                                          \
+         3, 31, 0, WARN)                                                      \
   SELECT(POLICY, CMP0175, "add_custom_command() rejects invalid arguments.",  \
-         3, 31, 0, cmPolicies::WARN)                                          \
+         3, 31, 0, WARN)                                                      \
   SELECT(POLICY, CMP0176, "execute_process() ENCODING is UTF-8 by default.",  \
-         3, 31, 0, cmPolicies::WARN)                                          \
+         3, 31, 0, WARN)                                                      \
   SELECT(POLICY, CMP0177, "install() DESTINATION paths are normalized.", 3,   \
-         31, 0, cmPolicies::WARN)                                             \
+         31, 0, WARN)                                                         \
   SELECT(POLICY, CMP0178, "Test command lines preserve empty arguments.", 3,  \
-         31, 0, cmPolicies::WARN)                                             \
+         31, 0, WARN)                                                         \
   SELECT(POLICY, CMP0179,                                                     \
          "De-duplication of static libraries on link lines keeps first "      \
          "occurrence.",                                                       \
-         3, 31, 0, cmPolicies::WARN)                                          \
+         3, 31, 0, WARN)                                                      \
   SELECT(POLICY, CMP0180,                                                     \
          "project() always sets <PROJECT-NAME>_* as normal variables.", 3,    \
-         31, 0, cmPolicies::WARN)                                             \
+         31, 0, WARN)                                                         \
   SELECT(POLICY, CMP0181,                                                     \
          "Link command-line fragment variables are parsed and re-quoted.", 3, \
-         32, 0, cmPolicies::WARN)
+         32, 0, WARN)
 
 #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
 #define CM_FOR_EACH_POLICY_ID(POLICY)                                         \
@@ -621,10 +614,6 @@ public:
     OLD,  ///< Use old behavior
     WARN, ///< Use old behavior but issue a warning
     NEW,  ///< Use new behavior
-    /// Issue an error if user doesn't set policy status to NEW and hits the
-    /// check
-    REQUIRED_IF_USED,
-    REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW.
   };
 
   /// Policy identifiers
@@ -645,8 +634,8 @@ public:
   //! convert a string policy ID into a number
   static bool GetPolicyID(const char* id, /* out */ cmPolicies::PolicyID& pid);
 
-  //! Get the default status for a policy
-  static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
+  //! Return whether a policy has been removed.
+  static bool IsRemoved(cmPolicies::PolicyID id);
 
   enum class WarnCompat
   {
@@ -668,10 +657,7 @@ public:
   static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id);
 
   //! return an error string for when a required policy is unspecified
-  static std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
-
-  //! return an error string for when a required policy is unspecified
-  static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
+  static std::string GetRemovedPolicyError(cmPolicies::PolicyID id);
 
   /** Represent a set of policy values.  */
   struct PolicyMap

+ 0 - 6
Source/cmQtAutoGenInitializer.cxx

@@ -433,8 +433,6 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
     case cmPolicies::OLD:
       // Ignore GENERATED files
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       // Process GENERATED files
       this->CMP0071Accept = true;
@@ -450,8 +448,6 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
     case cmPolicies::OLD:
       // Ignore .hh files
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       // Process .hh file
       this->CMP0100Accept = true;
@@ -669,8 +665,6 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
         case cmPolicies::OLD:
           addBefore = true;
           break;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
         case cmPolicies::NEW:
           this->GenTarget->AddSystemIncludeDirectory(this->Dir.IncludeGenExp,
                                                      "CXX");

+ 0 - 7
Source/cmReturnCommand.cxx

@@ -29,13 +29,6 @@ bool cmReturnCommand(std::vector<std::string> const& args,
         CM_FALLTHROUGH;
       case cmPolicies::OLD:
         return true;
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-        status.GetMakefile().IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmStrCat('\n', cmPolicies::GetPolicyWarning(cmPolicies::CMP0140)));
-        cmSystemTools::SetFatalErrorOccurred();
-        return false;
       default:
         break;
     }

+ 0 - 2
Source/cmSourceFile.cxx

@@ -226,8 +226,6 @@ bool cmSourceFile::FindFullPath(std::string* error,
         err = cmStrCat(err, " .", ext);
       }
       break;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
       break;
   }

+ 0 - 2
Source/cmState.cxx

@@ -464,8 +464,6 @@ void cmState::AddDisallowedCommand(std::string const& name,
           CM_FALLTHROUGH;
         case cmPolicies::OLD:
           break;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
         case cmPolicies::NEW:
           mf.IssueMessage(MessageType::FATAL_ERROR, message);
           return true;

+ 4 - 5
Source/cmStateSnapshot.cxx

@@ -165,13 +165,12 @@ void cmStateSnapshot::SetPolicy(cmPolicies::PolicyID id,
 cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy(cmPolicies::PolicyID id,
                                                     bool parent_scope) const
 {
-  cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id);
-
-  if (status == cmPolicies::REQUIRED_ALWAYS ||
-      status == cmPolicies::REQUIRED_IF_USED) {
-    return status;
+  if (cmPolicies::IsRemoved(id)) {
+    return cmPolicies::NEW;
   }
 
+  cmPolicies::PolicyStatus status = cmPolicies::WARN;
+
   cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator dir =
     this->Position->BuildSystemDirectory;
 

+ 0 - 6
Source/cmTarget.cxx

@@ -120,8 +120,6 @@ cmValue cmTargetPropertyComputer::GetSources<cmTarget>(cmTarget const* tgt,
             CM_FALLTHROUGH;
           case cmPolicies::OLD:
             break;
-          case cmPolicies::REQUIRED_ALWAYS:
-          case cmPolicies::REQUIRED_IF_USED:
           case cmPolicies::NEW:
             addContent = true;
             break;
@@ -1416,8 +1414,6 @@ std::string cmTargetInternals::ProcessSourceItemCMP0049(
       case cmPolicies::OLD:
         noMessage = true;
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::NEW:
         messageType = MessageType::FATAL_ERROR;
     }
@@ -2106,8 +2102,6 @@ struct ReadOnlyProperty
         case cmPolicies::OLD:
           readOnly = false;
           break;
-        case cmPolicies::REQUIRED_ALWAYS:
-        case cmPolicies::REQUIRED_IF_USED:
         case cmPolicies::NEW:
           context->IssueMessage(MessageType::FATAL_ERROR,
                                 this->message(prop, target));

+ 0 - 10
Source/cmTargetLinkLibrariesCommand.cxx

@@ -115,10 +115,6 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
         case cmPolicies::OLD: // OLD behavior does not warn.
           t = MessageType::MESSAGE;
           break;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
-          e << '\n' << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0016);
-          break;
         case cmPolicies::NEW: // NEW behavior prints the error.
           break;
       }
@@ -150,8 +146,6 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
         CM_FALLTHROUGH;
       case cmPolicies::OLD:
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::NEW:
         modal = "must";
         messageType = MessageType::FATAL_ERROR;
@@ -408,8 +402,6 @@ TLL::TLL(cmMakefile& mf, cmTarget* target)
       case cmPolicies::OLD:
         this->RejectRemoteLinking = true;
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::NEW:
         this->EncodeRemoteReference = true;
         break;
@@ -461,8 +453,6 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState,
         CM_FALLTHROUGH;
       case cmPolicies::OLD:
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::NEW:
         modal = "must";
         messageType = MessageType::FATAL_ERROR;

+ 0 - 2
Source/cmTargetPropertyComputer.cxx

@@ -22,8 +22,6 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
       CM_FALLTHROUGH;
     case cmPolicies::OLD:
       break;
-    case cmPolicies::REQUIRED_ALWAYS:
-    case cmPolicies::REQUIRED_IF_USED:
     case cmPolicies::NEW:
       modal = "may";
       messageType = MessageType::FATAL_ERROR;

+ 0 - 6
Source/cmTargetSourcesCommand.cxx

@@ -165,12 +165,6 @@ std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
       case cmPolicies::OLD:
         issueMessage = false;
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
-        this->Makefile->IssueMessage(
-          MessageType::FATAL_ERROR,
-          cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0076));
-        break;
       case cmPolicies::NEW: {
         issueMessage = false;
         useAbsoluteContent = true;

+ 0 - 2
Source/cmTestGenerator.cxx

@@ -49,8 +49,6 @@ bool needToQuoteTestName(const cmMakefile& mf, const std::string& name)
     case cmPolicies::OLD:
       // OLD behavior is to not quote the test's name.
       return false;
-    case cmPolicies::REQUIRED_IF_USED:
-    case cmPolicies::REQUIRED_ALWAYS:
     case cmPolicies::NEW:
     default:
       // NEW behavior is to quote the test's name.

+ 0 - 2
Source/cmWhileCommand.cxx

@@ -126,8 +126,6 @@ bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
       case cmPolicies::OLD:
         // OLD behavior is to silently ignore the error.
         break;
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::NEW:
         // NEW behavior is to enforce the error.
         enforceError = true;