file(CREATE_LINK): Revise CMP0205 warning

Ensure we only warn when COPY_ON_ERROR is specified. While we're at it,
tweak the spelling and apply consistent policy & logic ordering in
compound conditions.
This commit is contained in:
Tyler Yankee
2026-04-12 18:43:48 -04:00
parent 2683d749a1
commit b894942d3e
3 changed files with 9 additions and 11 deletions

View File

@@ -3295,12 +3295,12 @@ bool HandleCreateLinkCommand(std::vector<std::string> const& args,
if (sourceIsDirectory) {
if (cmp0205 == cmPolicies::NEW) {
needToTry = false;
} else if (cmp0205 == cmPolicies::WARN) {
} else if (cmp0205 == cmPolicies::WARN && arguments.CopyOnError) {
status.GetMakefile().IssueMessage(
MessageType::AUTHOR_WARNING,
cmStrCat("Path\n ", fileName,
"\nis directory. Hardlinks creation is not supported for "
"directories.\n",
"\nis a directory. Hard link creation is not supported "
"for directories.\n",
cmPolicies::GetPolicyWarning(cmPolicies::CMP0205)));
}
}
@@ -3320,13 +3320,13 @@ bool HandleCreateLinkCommand(std::vector<std::string> const& args,
}
}
if (arguments.CopyOnError && cmp0205 == cmPolicies::WARN &&
if (cmp0205 == cmPolicies::WARN && arguments.CopyOnError &&
sourceIsDirectory) {
status.GetMakefile().IssueMessage(
MessageType::AUTHOR_WARNING,
cmStrCat("Path\n ", fileName,
"\nis directory. It will be copied recursively when NEW policy "
"behavior applies for CMP0205.\n",
"\nis a directory. It will be copied "
"recursively when CMP0205 is set to NEW.\n",
cmPolicies::GetPolicyWarning(cmPolicies::CMP0205)));
}

View File

@@ -5,7 +5,7 @@
[^
]*[\\|/]file-CREATE_LINK[\\|/]CMP0205
is directory. Hardlinks creation is not supported for directories.
is a directory. Hard link creation is not supported for directories.
Policy CMP0205 is not set: file\(CREATE_LINK\) with COPY_ON_ERROR copies
directory content\. Run "cmake --help-policy CMP0205" for policy details\.
@@ -24,8 +24,7 @@ CMake Warning \(dev\) at [^
[^
]*[\\|/]file-CREATE_LINK[\\|/]CMP0205
is directory. It will be copied recursively when NEW policy behavior
applies for CMP0205\.
is a directory. It will be copied recursively when CMP0205 is set to NEW\.
Policy CMP0205 is not set: file\(CREATE_LINK\) with COPY_ON_ERROR copies
directory content\. Run "cmake --help-policy CMP0205" for policy details\.

View File

@@ -5,8 +5,7 @@
[^
]*[\\|/]file-CREATE_LINK[\\|/]CMP0205
is directory. It will be copied recursively when NEW policy behavior
applies for CMP0205\.
is a directory. It will be copied recursively when CMP0205 is set to NEW\.
Policy CMP0205 is not set: file\(CREATE_LINK\) with COPY_ON_ERROR copies
directory content\. Run "cmake --help-policy CMP0205" for policy details\.