| 5049 | |
| 5050 | protected: |
| 5051 | cmGeneratorTarget* GetTarget( |
| 5052 | std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval, |
| 5053 | GeneratorExpressionContent const* content, |
| 5054 | cmGeneratorExpressionDAGChecker* dagChecker) const |
| 5055 | { |
| 5056 | // Lookup the referenced target. |
| 5057 | std::string const& name = parameters.front(); |
| 5058 | |
| 5059 | if (!cmGeneratorExpression::IsValidTargetName(name)) { |
| 5060 | ::reportError(eval, content->GetOriginalExpression(), |
| 5061 | "Expression syntax not recognized."); |
| 5062 | return nullptr; |
| 5063 | } |
| 5064 | cmGeneratorTarget* target = |
| 5065 | eval->Context.LG->FindGeneratorTargetToUse(name); |
| 5066 | if (!target) { |
| 5067 | ::reportError(eval, content->GetOriginalExpression(), |
| 5068 | cmStrCat("No target \"", name, '"')); |
| 5069 | return nullptr; |
| 5070 | } |
| 5071 | if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY && |
| 5072 | target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) { |
| 5073 | ::reportError( |
| 5074 | eval, content->GetOriginalExpression(), |
| 5075 | cmStrCat("Target \"", name, "\" is not an executable or library.")); |
| 5076 | return nullptr; |
| 5077 | } |
| 5078 | if (dagChecker && |
| 5079 | (dagChecker->EvaluatingLinkLibraries(target) || |
| 5080 | (dagChecker->EvaluatingSources() && |
| 5081 | target == dagChecker->TopTarget()))) { |
| 5082 | ::reportError(eval, content->GetOriginalExpression(), |
| 5083 | "Expressions which require the linker language may not " |
| 5084 | "be used while evaluating link libraries"); |
| 5085 | return nullptr; |
| 5086 | } |
| 5087 | |
| 5088 | return target; |
| 5089 | } |
| 5090 | }; |
| 5091 | |
| 5092 | template <typename ArtifactT, typename ComponentT> |
no test coverage detected