cmGeneratorTarget: Add GetLinkImplementationClosure mode for linking

Previously this method always returned the closure for compile-only
usage requirements.  Add an option to get the closure for linking, which
pierces `$<LINK_ONLY>`.
This commit is contained in:
Brad King
2024-05-08 15:49:26 -04:00
parent a11cbcc268
commit e64d09a729
4 changed files with 24 additions and 14 deletions
@@ -31,6 +31,10 @@
#include "cmSystemTools.h"
#include "cmValue.h"
namespace {
using UseTo = cmGeneratorTarget::UseTo;
}
const cmGeneratorTarget::CompatibleInterfacesBase&
cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
{
@@ -41,7 +45,7 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
compat.PropsBool.insert("POSITION_INDEPENDENT_CODE");
compat.PropsString.insert("AUTOUIC_OPTIONS");
std::vector<cmGeneratorTarget const*> const& deps =
this->GetLinkImplementationClosure(config);
this->GetLinkImplementationClosure(config, UseTo::Compile);
for (cmGeneratorTarget const* li : deps) {
#define CM_READ_COMPATIBLE_INTERFACE(X, x) \
if (cmValue prop = li->GetProperty("COMPATIBLE_INTERFACE_" #X)) { \
@@ -573,7 +577,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
assert((impliedByUse ^ explicitlySet) || (!impliedByUse && !explicitlySet));
std::vector<cmGeneratorTarget const*> const& deps =
tgt->GetLinkImplementationClosure(config);
tgt->GetLinkImplementationClosure(config, UseTo::Compile);
if (deps.empty()) {
return propContent;