summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-05-14 14:40:55 (GMT)
committerBrad King <brad.king@kitware.com>2024-05-14 14:44:47 (GMT)
commitc773d5b436fcf8e773809e8594eec1ac3701ce82 (patch)
tree2275be9fd49208e1ea13c44043e75aa3e5a82ac7 /Source/cmGlobalGenerator.cxx
parent065729b6d142d5297ac6e612fe26eeb890989127 (diff)
downloadCMake-c773d5b436fcf8e773809e8594eec1ac3701ce82.zip
CMake-c773d5b436fcf8e773809e8594eec1ac3701ce82.tar.gz
CMake-c773d5b436fcf8e773809e8594eec1ac3701ce82.tar.bz2
CMP0037: Restore diagnostic message for invalid ALIAS target names
Refactoring in commit 7a4c02cb38 (cmGlobalGenerator: factor out messaging for CMP0037, 2023-09-24, v3.28.0-rc1~39^2~7) incorrectly switched to reporting the aliased target name instead of the invalid name of the alias itself. Fixes: #25979
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ba1938f..759a7d6 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2707,6 +2707,7 @@ cmGlobalGenerator::SplitFrameworkPath(const std::string& path,
}
static bool RaiseCMP0037Message(cmake* cm, cmTarget* tgt,
+ std::string const& targetNameAsWritten,
std::string const& reason)
{
MessageType messageType = MessageType::AUTHOR_WARNING;
@@ -2727,8 +2728,8 @@ static bool RaiseCMP0037Message(cmake* cm, cmTarget* tgt,
break;
}
if (issueMessage) {
- e << "The target name \"" << tgt->GetName() << "\" is reserved " << reason
- << ".";
+ e << "The target name \"" << targetNameAsWritten << "\" is reserved "
+ << reason << ".";
if (messageType == MessageType::AUTHOR_WARNING) {
e << " It may result in undefined behavior.";
}
@@ -2747,7 +2748,8 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
if (!tgt) {
return true;
}
- return RaiseCMP0037Message(this->GetCMakeInstance(), tgt, reason);
+ return RaiseCMP0037Message(this->GetCMakeInstance(), tgt, targetName,
+ reason);
}
void cmGlobalGenerator::CreateDefaultGlobalTargets(