summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-01-28 15:57:32 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-01-31 15:07:02 (GMT)
commite80689d10199a3f4d09a564bd033004e698b150f (patch)
treee96eaa1b3140ce20ac0082c73aa478a5a8d8b2b8
parent4f009d2121ac5f46e21786c7d60eb11e2e33c05d (diff)
downloadCMake-e80689d10199a3f4d09a564bd033004e698b150f.zip
CMake-e80689d10199a3f4d09a564bd033004e698b150f.tar.gz
CMake-e80689d10199a3f4d09a564bd033004e698b150f.tar.bz2
cmTarget: refactor LINK_LIBRARIES usage requirements
-rw-r--r--Source/cmTarget.cxx34
1 files changed, 9 insertions, 25 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1055a9a..5befa05 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -305,7 +305,6 @@ public:
std::map<std::string, BTs<std::string>> LanguageStandardProperties;
std::map<cmTargetExport const*, std::vector<std::string>>
InstallIncludeDirectoriesEntries;
- std::vector<BT<std::string>> LinkImplementationPropertyEntries;
std::vector<BT<std::string>> LinkInterfacePropertyEntries;
std::vector<BT<std::string>> LinkInterfaceDirectPropertyEntries;
std::vector<BT<std::string>> LinkInterfaceDirectExcludePropertyEntries;
@@ -322,6 +321,7 @@ public:
UsageRequirementProperty Sources;
UsageRequirementProperty LinkOptions;
UsageRequirementProperty LinkDirectories;
+ UsageRequirementProperty LinkLibraries;
FileSetType HeadersFileSets;
FileSetType CxxModulesFileSets;
@@ -366,6 +366,7 @@ cmTargetInternals::cmTargetInternals()
, Sources("SOURCES"_s, UsageRequirementProperty::AppendEmpty::Yes)
, LinkOptions("LINK_OPTIONS"_s)
, LinkDirectories("LINK_DIRECTORIES"_s)
+ , LinkLibraries("LINK_LIBRARIES"_s)
, HeadersFileSets("HEADERS"_s, "HEADER_DIRS"_s, "HEADER_SET"_s,
"HEADER_DIRS_"_s, "HEADER_SET_"_s, "Header"_s,
"The default header set"_s, "Header set"_s,
@@ -1498,7 +1499,7 @@ cmBTStringRange cmTarget::GetLinkDirectoriesEntries() const
cmBTStringRange cmTarget::GetLinkImplementationEntries() const
{
- return cmMakeRange(this->impl->LinkImplementationPropertyEntries);
+ return cmMakeRange(this->impl->LinkLibraries.Entries);
}
cmBTStringRange cmTarget::GetLinkInterfaceEntries() const
@@ -1647,6 +1648,7 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value)
&this->impl->CompileFeatures, &this->impl->CompileDefinitions,
&this->impl->PrecompileHeaders, &this->impl->Sources,
&this->impl->LinkOptions, &this->impl->LinkDirectories,
+ &this->impl->LinkLibraries,
};
for (auto* usageRequirement : usageRequirements) {
@@ -1669,13 +1671,7 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value)
}
}
- if (prop == propLINK_LIBRARIES) {
- this->impl->LinkImplementationPropertyEntries.clear();
- if (value) {
- cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace();
- this->impl->LinkImplementationPropertyEntries.emplace_back(value, lfbt);
- }
- } else if (prop == propINTERFACE_LINK_LIBRARIES) {
+ if (prop == propINTERFACE_LINK_LIBRARIES) {
this->impl->LinkInterfacePropertyEntries.clear();
if (value) {
cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace();
@@ -1814,6 +1810,7 @@ void cmTarget::AppendProperty(const std::string& prop,
&this->impl->CompileFeatures, &this->impl->CompileDefinitions,
&this->impl->PrecompileHeaders, &this->impl->Sources,
&this->impl->LinkOptions, &this->impl->LinkDirectories,
+ &this->impl->LinkLibraries,
};
for (auto* usageRequirement : usageRequirements) {
@@ -1836,12 +1833,7 @@ void cmTarget::AppendProperty(const std::string& prop,
}
}
- if (prop == "LINK_LIBRARIES") {
- if (!value.empty()) {
- cmListFileBacktrace lfbt = this->impl->GetBacktrace(bt);
- this->impl->LinkImplementationPropertyEntries.emplace_back(value, lfbt);
- }
- } else if (prop == propINTERFACE_LINK_LIBRARIES) {
+ if (prop == propINTERFACE_LINK_LIBRARIES) {
if (!value.empty()) {
cmListFileBacktrace lfbt = this->impl->GetBacktrace(bt);
this->impl->LinkInterfacePropertyEntries.emplace_back(value, lfbt);
@@ -2051,7 +2043,7 @@ void cmTarget::FinalizeTargetConfiguration(
}
if (!CheckLinkLibraryPattern("LINK_LIBRARIES"_s,
- this->impl->LinkImplementationPropertyEntries,
+ this->impl->LinkLibraries.Entries,
this->GetMakefile()->GetCMakeInstance()) ||
!CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES"_s,
this->impl->LinkInterfacePropertyEntries,
@@ -2291,6 +2283,7 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
&this->impl->CompileFeatures, &this->impl->CompileDefinitions,
&this->impl->PrecompileHeaders, &this->impl->Sources,
&this->impl->LinkOptions, &this->impl->LinkDirectories,
+ &this->impl->LinkLibraries,
};
for (auto const* usageRequirement : usageRequirements) {
@@ -2300,15 +2293,6 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
}
}
- if (prop == propLINK_LIBRARIES) {
- if (this->impl->LinkImplementationPropertyEntries.empty()) {
- return nullptr;
- }
-
- static std::string output;
- output = cmJoin(this->impl->LinkImplementationPropertyEntries, ";");
- return cmValue(output);
- }
if (prop == propINTERFACE_LINK_LIBRARIES) {
if (this->impl->LinkInterfacePropertyEntries.empty()) {
return nullptr;