CMP0013: Remove support for OLD behavior

This commit is contained in:
Brad King
2024-11-17 10:23:13 -05:00
parent 98a59ba8ad
commit fad9c55b8b
3 changed files with 17 additions and 44 deletions
+5 -4
View File
@@ -1,6 +1,9 @@
CMP0013 CMP0013
------- -------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Duplicate binary directories are not allowed. Duplicate binary directories are not allowed.
CMake 2.6.3 and below silently permitted add_subdirectory() calls to 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. with an error.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.0 .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.0
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns .. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: STANDARD_ADVICE.txt .. include:: REMOVED_EPILOGUE.txt
.. include:: DEPRECATED.txt
+11 -39
View File
@@ -4341,45 +4341,17 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
if (gg->BinaryDirectoryIsNew(binPath)) { if (gg->BinaryDirectoryIsNew(binPath)) {
return true; return true;
} }
std::string e; this->IssueMessage(MessageType::FATAL_ERROR,
switch (this->GetPolicyStatus(cmPolicies::CMP0013)) { cmStrCat("The binary directory\n"
case cmPolicies::WARN: " ",
// Print the warning. binPath,
e = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0013), "\n"
"\n" "is already used to build a source directory. "
"The binary directory\n" "It cannot be used to build source directory\n"
" ", " ",
binPath, srcPath,
"\n" "\n"
"is already used to build a source directory. " "Specify a unique binary directory name."));
"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;
}
return false; return false;
} }
+1 -1
View File
@@ -51,7 +51,7 @@ class cmMakefile;
SELECT(POLICY, CMP0012, "if() recognizes numbers and boolean constants.", \ SELECT(POLICY, CMP0012, "if() recognizes numbers and boolean constants.", \
2, 8, 0, NEW) \ 2, 8, 0, NEW) \
SELECT(POLICY, CMP0013, "Duplicate binary directories are not allowed.", 2, \ 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, \ SELECT(POLICY, CMP0014, "Input directories must have CMakeLists.txt.", 2, \
8, 0, WARN) \ 8, 0, WARN) \
SELECT(POLICY, CMP0015, \ SELECT(POLICY, CMP0015, \