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 (sourceIsDirectory) {
if (cmp0205 == cmPolicies::NEW) { if (cmp0205 == cmPolicies::NEW) {
needToTry = false; needToTry = false;
} else if (cmp0205 == cmPolicies::WARN) { } else if (cmp0205 == cmPolicies::WARN && arguments.CopyOnError) {
status.GetMakefile().IssueMessage( status.GetMakefile().IssueMessage(
MessageType::AUTHOR_WARNING, MessageType::AUTHOR_WARNING,
cmStrCat("Path\n ", fileName, cmStrCat("Path\n ", fileName,
"\nis directory. Hardlinks creation is not supported for " "\nis a directory. Hard link creation is not supported "
"directories.\n", "for directories.\n",
cmPolicies::GetPolicyWarning(cmPolicies::CMP0205))); 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) { sourceIsDirectory) {
status.GetMakefile().IssueMessage( status.GetMakefile().IssueMessage(
MessageType::AUTHOR_WARNING, MessageType::AUTHOR_WARNING,
cmStrCat("Path\n ", fileName, cmStrCat("Path\n ", fileName,
"\nis directory. It will be copied recursively when NEW policy " "\nis a directory. It will be copied "
"behavior applies for CMP0205.\n", "recursively when CMP0205 is set to NEW.\n",
cmPolicies::GetPolicyWarning(cmPolicies::CMP0205))); cmPolicies::GetPolicyWarning(cmPolicies::CMP0205)));
} }

View File

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

View File

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