1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-20 04:24:36 +08:00

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

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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, \