summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGeneratorTarget.cxx14
-rw-r--r--Source/cmGeneratorTarget.h1
-rw-r--r--Source/cmTarget.cxx11
-rw-r--r--Source/cmTarget.h1
4 files changed, 27 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 9f814c2..312f570 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -173,6 +173,20 @@ const std::string& cmGeneratorTarget::GetName() const
return this->Target->GetName();
}
+std::string cmGeneratorTarget::GetFamilyName() const
+{
+ if (!this->IsImported() && !this->IsSynthetic()) {
+ return this->Target->GetTemplateName();
+ }
+ cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_512);
+ constexpr size_t HASH_TRUNCATION = 12;
+ auto dirhash =
+ hasher.HashString(this->GetLocalGenerator()->GetCurrentBinaryDirectory());
+ auto targetIdent = hasher.HashString(cmStrCat("@d_", dirhash));
+ return cmStrCat(this->Target->GetTemplateName(), '@',
+ targetIdent.substr(0, HASH_TRUNCATION));
+}
+
std::string cmGeneratorTarget::GetExportName() const
{
cmValue exportName = this->GetProperty("EXPORT_NAME");
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 85e6911..dcd4955 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -108,6 +108,7 @@ public:
cmStateEnums::TargetType GetType() const;
const std::string& GetName() const;
+ std::string GetFamilyName() const;
std::string GetExportName() const;
std::string GetFilesystemExportName() const;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d609d80..32fd16f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -645,6 +645,7 @@ public:
cmStateEnums::TargetType TargetType;
cmMakefile* Makefile;
cmPolicies::PolicyMap PolicyMap;
+ cmTarget const* TemplateTarget;
std::string Name;
std::string InstallPath;
std::string RuntimeInstallPath;
@@ -931,6 +932,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->impl->TargetType = type;
this->impl->Makefile = mf;
this->impl->Name = name;
+ this->impl->TemplateTarget = nullptr;
this->impl->IsGeneratorProvided = false;
this->impl->HaveInstallRule = false;
this->impl->IsDLLPlatform = false;
@@ -1186,6 +1188,14 @@ const std::string& cmTarget::GetName() const
return this->impl->Name;
}
+const std::string& cmTarget::GetTemplateName() const
+{
+ if (this->impl->TemplateTarget) {
+ return this->impl->TemplateTarget->GetTemplateName();
+ }
+ return this->impl->Name;
+}
+
cmPolicies::PolicyStatus cmTarget::GetPolicyStatus(
cmPolicies::PolicyID policy) const
{
@@ -1784,6 +1794,7 @@ void cmTarget::CopyPolicyStatuses(cmTarget const* tgt)
assert(tgt->IsImported());
this->impl->PolicyMap = tgt->impl->PolicyMap;
+ this->impl->TemplateTarget = tgt;
}
void cmTarget::CopyImportedCxxModulesEntries(cmTarget const* tgt)
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 98cacef..d0e9e3d 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -78,6 +78,7 @@ public:
//! Set/Get the name of the target
const std::string& GetName() const;
+ const std::string& GetTemplateName() const;
//! Get the policy map
cmPolicies::PolicyMap const& GetPolicyMap() const;