diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2022-07-06 13:06:53 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2022-07-06 14:15:43 (GMT) |
commit | 913ea78d7a22302fcaecb284096239bdb05b6206 (patch) | |
tree | 109938d99efb12ab3be17643e6897c9176c26085 /Source/cmGeneratorExpressionNode.cxx | |
parent | 4a8db1783ccc48bfdb9060dfff5775ba42cd94cb (diff) | |
download | CMake-913ea78d7a22302fcaecb284096239bdb05b6206.zip CMake-913ea78d7a22302fcaecb284096239bdb05b6206.tar.gz CMake-913ea78d7a22302fcaecb284096239bdb05b6206.tar.bz2 |
Genex LINK_LIBRARY and LINK_GROUP: check supported properties
Refines check for properties supporting these genex.
Enhance error message.
Fixes: #23699
Diffstat (limited to 'Source/cmGeneratorExpressionNode.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index d773fdf..45d5a83 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1662,11 +1662,16 @@ static const struct LinkLibraryNode : public cmGeneratorExpressionNode const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const override { + using ForGenex = cmGeneratorExpressionDAGChecker::ForGenex; + if (!context->HeadTarget || !dagChecker || - !dagChecker->EvaluatingLinkLibraries()) { + !dagChecker->EvaluatingLinkLibraries(nullptr, + ForGenex::LINK_LIBRARY)) { reportError(context, content->GetOriginalExpression(), "$<LINK_LIBRARY:...> may only be used with binary targets " - "to specify link libraries."); + "to specify link libraries through 'LINK_LIBRARIES', " + "'INTERFACE_LINK_LIBRARIES', and " + "'INTERFACE_LINK_LIBRARIES_DIRECT' properties."); return std::string(); } @@ -1743,11 +1748,16 @@ static const struct LinkGroupNode : public cmGeneratorExpressionNode const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const override { + using ForGenex = cmGeneratorExpressionDAGChecker::ForGenex; + if (!context->HeadTarget || !dagChecker || - !dagChecker->EvaluatingLinkLibraries()) { - reportError(context, content->GetOriginalExpression(), - "$<LINK_GROUP:...> may only be used with binary targets " - "to specify group of link libraries."); + !dagChecker->EvaluatingLinkLibraries(nullptr, ForGenex::LINK_GROUP)) { + reportError( + context, content->GetOriginalExpression(), + "$<LINK_GROUP:...> may only be used with binary targets " + "to specify group of link libraries through 'LINK_LIBRARIES', " + "'INTERFACE_LINK_LIBRARIES', and " + "'INTERFACE_LINK_LIBRARIES_DIRECT' properties."); return std::string(); } |