summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-09-24 23:13:32 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-09-25 21:39:35 (GMT)
commit7a4c02cb38547e719d53196c16cbe10743dce995 (patch)
tree978bade3d840d937a8e794f08d52f86e8306f2f8 /Source
parent34b393f97f90a5ac7cb4f39f344f5ea99e1d3c03 (diff)
downloadCMake-7a4c02cb38547e719d53196c16cbe10743dce995.zip
CMake-7a4c02cb38547e719d53196c16cbe10743dce995.tar.gz
CMake-7a4c02cb38547e719d53196c16cbe10743dce995.tar.bz2
cmGlobalGenerator: factor out messaging for CMP0037
Also make some strings into character literals.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx23
1 files changed, 14 insertions, 9 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 8734988..933e754 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2690,13 +2690,9 @@ cmGlobalGenerator::SplitFrameworkPath(const std::string& path,
return cm::nullopt;
}
-bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
- std::string const& reason) const
+static bool RaiseCMP0037Message(cmake* cm, cmTarget* tgt,
+ std::string const& reason)
{
- cmTarget* tgt = this->FindTarget(targetName);
- if (!tgt) {
- return true;
- }
MessageType messageType = MessageType::AUTHOR_WARNING;
std::ostringstream e;
bool issueMessage = false;
@@ -2715,13 +2711,12 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
break;
}
if (issueMessage) {
- e << "The target name \"" << targetName << "\" is reserved " << reason
+ e << "The target name \"" << tgt->GetName() << "\" is reserved " << reason
<< ".";
if (messageType == MessageType::AUTHOR_WARNING) {
e << " It may result in undefined behavior.";
}
- this->GetCMakeInstance()->IssueMessage(messageType, e.str(),
- tgt->GetBacktrace());
+ cm->IssueMessage(messageType, e.str(), tgt->GetBacktrace());
if (messageType == MessageType::FATAL_ERROR) {
return false;
}
@@ -2729,6 +2724,16 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
return true;
}
+bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
+ std::string const& reason) const
+{
+ cmTarget* tgt = this->FindTarget(targetName);
+ if (!tgt) {
+ return true;
+ }
+ return RaiseCMP0037Message(this->GetCMakeInstance(), tgt, reason);
+}
+
void cmGlobalGenerator::CreateDefaultGlobalTargets(
std::vector<GlobalTargetInfo>& targets)
{