Introduce the LINK_ONLY generator expression.
This is an internal expression for use by target_link_libraries for static libraries.
This commit is contained in:
parent
5aa9731c9f
commit
ddde61c0b2
|
@ -22,7 +22,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
|
||||||
const GeneratorExpressionContent *content,
|
const GeneratorExpressionContent *content,
|
||||||
cmGeneratorExpressionDAGChecker *parent)
|
cmGeneratorExpressionDAGChecker *parent)
|
||||||
: Parent(parent), Target(target), Property(property),
|
: Parent(parent), Target(target), Property(property),
|
||||||
Content(content), Backtrace(backtrace)
|
Content(content), Backtrace(backtrace), TransitivePropertiesOnly(false)
|
||||||
{
|
{
|
||||||
const cmGeneratorExpressionDAGChecker *top = this;
|
const cmGeneratorExpressionDAGChecker *top = this;
|
||||||
const cmGeneratorExpressionDAGChecker *p = this->Parent;
|
const cmGeneratorExpressionDAGChecker *p = this->Parent;
|
||||||
|
@ -138,6 +138,20 @@ cmGeneratorExpressionDAGChecker::checkGraph() const
|
||||||
return DAG;
|
return DAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnly()
|
||||||
|
{
|
||||||
|
const cmGeneratorExpressionDAGChecker *top = this;
|
||||||
|
const cmGeneratorExpressionDAGChecker *parent = this->Parent;
|
||||||
|
while (parent)
|
||||||
|
{
|
||||||
|
top = parent;
|
||||||
|
parent = parent->Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return top->TransitivePropertiesOnly;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(const char *tgt)
|
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(const char *tgt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,10 @@ struct cmGeneratorExpressionDAGChecker
|
||||||
|
|
||||||
CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
|
CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
|
||||||
|
|
||||||
|
bool GetTransitivePropertiesOnly();
|
||||||
|
void SetTransitivePropertiesOnly()
|
||||||
|
{ this->TransitivePropertiesOnly = true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Result checkGraph() const;
|
Result checkGraph() const;
|
||||||
|
|
||||||
|
@ -65,6 +69,7 @@ private:
|
||||||
const GeneratorExpressionContent * const Content;
|
const GeneratorExpressionContent * const Content;
|
||||||
const cmListFileBacktrace Backtrace;
|
const cmListFileBacktrace Backtrace;
|
||||||
Result CheckResult;
|
Result CheckResult;
|
||||||
|
bool TransitivePropertiesOnly;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -491,6 +491,24 @@ static const struct VersionEqualNode : public cmGeneratorExpressionNode
|
||||||
}
|
}
|
||||||
} versionEqualNode;
|
} versionEqualNode;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static const struct LinkOnlyNode : public cmGeneratorExpressionNode
|
||||||
|
{
|
||||||
|
LinkOnlyNode() {}
|
||||||
|
|
||||||
|
std::string Evaluate(const std::vector<std::string> ¶meters,
|
||||||
|
cmGeneratorExpressionContext *,
|
||||||
|
const GeneratorExpressionContent *,
|
||||||
|
cmGeneratorExpressionDAGChecker *dagChecker) const
|
||||||
|
{
|
||||||
|
if(!dagChecker->GetTransitivePropertiesOnly())
|
||||||
|
{
|
||||||
|
return parameters.front();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
} linkOnlyNode;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static const struct ConfigurationNode : public cmGeneratorExpressionNode
|
static const struct ConfigurationNode : public cmGeneratorExpressionNode
|
||||||
{
|
{
|
||||||
|
@ -1396,6 +1414,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
|
||||||
return &installPrefixNode;
|
return &installPrefixNode;
|
||||||
else if (identifier == "JOIN")
|
else if (identifier == "JOIN")
|
||||||
return &joinNode;
|
return &joinNode;
|
||||||
|
else if (identifier == "LINK_ONLY")
|
||||||
|
return &linkOnlyNode;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue