cmLinkItem: Remove now-unused fields from link interfaces

With CMP0022 removed, a link interface is now always explicit if it
exists.  It is also never derived from the link implementation.
This commit is contained in:
Brad King
2024-11-18 19:31:55 -05:00
parent c965856a1d
commit 033a2dc000
3 changed files with 25 additions and 38 deletions

View File

@@ -17,7 +17,6 @@
#include "cmFindPackageStack.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmLinkItem.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -29,6 +28,8 @@
#include "cmValue.h"
#include "cmVersion.h"
struct cmLinkInterface;
static std::string cmExportFileGeneratorEscape(std::string const& str)
{
// Escape a property value for writing into a .cmake file.
@@ -110,14 +111,6 @@ void cmExportCMakeConfigGenerator::SetImportLinkInterface(
return;
}
if (iface->ImplementationIsInterface) {
// Policy CMP0022 must not be NEW.
this->SetImportLinkProperty(
suffix, target, "IMPORTED_LINK_INTERFACE_LIBRARIES", iface->Libraries,
properties, ImportLinkPropertyTargetNames::Yes);
return;
}
cmValue propContent;
if (cmValue prop_suffixed =

View File

@@ -680,32 +680,30 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config,
cmOptionalLinkInterface& iface,
bool secondPass) const
{
if (iface.Explicit) {
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
std::set<cmLinkItem> emitted;
for (cmLinkItem const& lib : iface.Libraries) {
emitted.insert(lib);
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
cmLinkImplementation const* impl =
this->GetLinkImplementation(config, UseTo::Link, secondPass);
for (cmLinkImplItem const& lib : impl->Libraries) {
if (emitted.insert(lib).second) {
if (lib.Target) {
// This is a runtime dependency on another shared library.
if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
iface.SharedDeps.push_back(lib);
}
} else {
// TODO: Recognize shared library file names. Perhaps this
// should be moved to cmComputeLinkInformation, but that
// creates a chicken-and-egg problem since this list is needed
// for its construction.
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
std::set<cmLinkItem> emitted;
for (cmLinkItem const& lib : iface.Libraries) {
emitted.insert(lib);
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
cmLinkImplementation const* impl =
this->GetLinkImplementation(config, UseTo::Link, secondPass);
for (cmLinkImplItem const& lib : impl->Libraries) {
if (emitted.insert(lib).second) {
if (lib.Target) {
// This is a runtime dependency on another shared library.
if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
iface.SharedDeps.push_back(lib);
}
} else {
// TODO: Recognize shared library file names. Perhaps this
// should be moved to cmComputeLinkInformation, but that
// creates a chicken-and-egg problem since this list is needed
// for its construction.
}
}
}
@@ -805,7 +803,6 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
return;
}
iface.Exists = true;
iface.Explicit = true;
// The interface libraries are specified by INTERFACE_LINK_LIBRARIES.
// Use its special representation directly to get backtraces.

View File

@@ -104,8 +104,6 @@ struct cmLinkInterface : public cmLinkInterfaceLibraries
// or more static libraries.
unsigned int Multiplicity = 0;
bool ImplementationIsInterface = false;
// Whether the list depends on a link language genex.
bool HadLinkLanguageSensitiveCondition = false;
};
@@ -115,7 +113,6 @@ struct cmOptionalLinkInterface : public cmLinkInterface
bool LibrariesDone = false;
bool AllDone = false;
bool Exists = false;
bool Explicit = false;
bool CheckLinkLibraries = false;
};