MCPcopy Create free account
hub / github.com/Kitware/CMake / GetTarget

Method GetTarget

Source/cmGeneratorExpressionNode.cxx:5051–5089  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5049
5050protected:
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
5092template <typename ArtifactT, typename ComponentT>

Callers 3

EvaluateMethod · 0.45
EvaluateMethod · 0.45
EvaluateMethod · 0.45

Calls 9

reportErrorFunction · 0.85
GetOriginalExpressionMethod · 0.80
EvaluatingSourcesMethod · 0.80
TopTargetMethod · 0.80
cmStrCatFunction · 0.70
frontMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected