mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-14 05:20:50 -05:00
cmTarget: refactor LINK_LIBRARIES usage requirements
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user