summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-12-17 21:19:43 (GMT)
committerBrad King <brad.king@kitware.com>2021-12-20 14:56:52 (GMT)
commit5134f099a32e2eb0d557ad86dabd8b811709c94d (patch)
treee302ecd94f477564162b02212f1eab18d140aa9c
parent37a25072eab0af07adb01594a9500d9a51a68be8 (diff)
downloadCMake-5134f099a32e2eb0d557ad86dabd8b811709c94d.zip
CMake-5134f099a32e2eb0d557ad86dabd8b811709c94d.tar.gz
CMake-5134f099a32e2eb0d557ad86dabd8b811709c94d.tar.bz2
cmGeneratorTarget: Factor out message about reasons for a missing target
-rw-r--r--Source/cmGeneratorTarget.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e370472..0036e69 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -6281,6 +6281,14 @@ void cmGeneratorTarget::CheckLinkLibraries() const
}
}
+namespace {
+cm::string_view missingTargetPossibleReasons =
+ "Possible reasons include:\n"
+ " * There is a typo in the target name.\n"
+ " * A find_package call is missing for an IMPORTED target.\n"
+ " * An ALIAS target is missing.\n"_s;
+}
+
bool cmGeneratorTarget::VerifyLinkItemColons(LinkItemRole role,
cmLinkItem const& item) const
{
@@ -6309,11 +6317,9 @@ bool cmGeneratorTarget::VerifyLinkItemColons(LinkItemRole role,
e = cmStrCat(e, "The link interface of target \"", this->GetName(),
"\" contains");
}
- e = cmStrCat(e, ":\n ", item.AsStr(), "\n",
- "but the target was not found. Possible reasons include:\n"
- " * There is a typo in the target name.\n"
- " * A find_package call is missing for an IMPORTED target.\n"
- " * An ALIAS target is missing.\n");
+ e =
+ cmStrCat(e, ":\n ", item.AsStr(), "\n", "but the target was not found. ",
+ missingTargetPossibleReasons);
cmListFileBacktrace backtrace = item.Backtrace;
if (backtrace.Empty()) {
backtrace = this->GetBacktrace();