Browse Source

CMP0013: Remove support for OLD behavior

Brad King 1 year ago
parent
commit
fad9c55b8b
3 changed files with 17 additions and 44 deletions
  1. 5 4
      Help/policy/CMP0013.rst
  2. 11 39
      Source/cmMakefile.cxx
  3. 1 1
      Source/cmPolicies.h

+ 5 - 4
Help/policy/CMP0013.rst

@@ -1,6 +1,9 @@
 CMP0013
 -------
 
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
 Duplicate binary directories are not allowed.
 
 CMake 2.6.3 and below silently permitted add_subdirectory() calls to
@@ -15,7 +18,5 @@ behavior for this policy is to disallow duplicate binary directories
 with an error.
 
 .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.0
-.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
-.. include:: STANDARD_ADVICE.txt
-
-.. include:: DEPRECATED.txt
+.. |WARNED_OR_DID_NOT_WARN| replace:: warned
+.. include:: REMOVED_EPILOGUE.txt

+ 11 - 39
Source/cmMakefile.cxx

@@ -4341,45 +4341,17 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
   if (gg->BinaryDirectoryIsNew(binPath)) {
     return true;
   }
-  std::string e;
-  switch (this->GetPolicyStatus(cmPolicies::CMP0013)) {
-    case cmPolicies::WARN:
-      // Print the warning.
-      e = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0013),
-                   "\n"
-                   "The binary directory\n"
-                   "  ",
-                   binPath,
-                   "\n"
-                   "is already used to build a source directory.  "
-                   "This command uses it to build source directory\n"
-                   "  ",
-                   srcPath,
-                   "\n"
-                   "which can generate conflicting build files.  "
-                   "CMake does not support this use case but it used "
-                   "to work accidentally and is being allowed for "
-                   "compatibility.");
-      this->IssueMessage(MessageType::AUTHOR_WARNING, e);
-      CM_FALLTHROUGH;
-    case cmPolicies::OLD:
-      // OLD behavior does not warn.
-      return true;
-    case cmPolicies::NEW:
-      // NEW behavior prints the error.
-      e += cmStrCat("The binary directory\n"
-                    "  ",
-                    binPath,
-                    "\n"
-                    "is already used to build a source directory.  "
-                    "It cannot be used to build source directory\n"
-                    "  ",
-                    srcPath,
-                    "\n"
-                    "Specify a unique binary directory name.");
-      this->IssueMessage(MessageType::FATAL_ERROR, e);
-      break;
-  }
+  this->IssueMessage(MessageType::FATAL_ERROR,
+                     cmStrCat("The binary directory\n"
+                              "  ",
+                              binPath,
+                              "\n"
+                              "is already used to build a source directory.  "
+                              "It cannot be used to build source directory\n"
+                              "  ",
+                              srcPath,
+                              "\n"
+                              "Specify a unique binary directory name."));
 
   return false;
 }

+ 1 - 1
Source/cmPolicies.h

@@ -51,7 +51,7 @@ class cmMakefile;
   SELECT(POLICY, CMP0012, "if() recognizes numbers and boolean constants.",   \
          2, 8, 0, NEW)                                                        \
   SELECT(POLICY, CMP0013, "Duplicate binary directories are not allowed.", 2, \
-         8, 0, WARN)                                                          \
+         8, 0, NEW)                                                           \
   SELECT(POLICY, CMP0014, "Input directories must have CMakeLists.txt.", 2,   \
          8, 0, WARN)                                                          \
   SELECT(POLICY, CMP0015,                                                     \