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

Method Evaluate

Source/cmGeneratorExpressionNode.cxx:3551–3579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3549 int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
3550
3551 std::string Evaluate(
3552 std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval,
3553 GeneratorExpressionContent const* content,
3554 cmGeneratorExpressionDAGChecker* dagChecker) const override
3555 {
3556 if (!eval->HeadTarget || !dagChecker ||
3557 !dagChecker->EvaluatingLinkOptionsExpression()) {
3558 reportError(eval, content->GetOriginalExpression(),
3559 "$<DEVICE_LINK:...> may only be used with binary targets "
3560 "to specify link options.");
3561 return std::string();
3562 }
3563
3564 if (eval->HeadTarget->IsDeviceLink()) {
3565 cmList list{ parameters.begin(), parameters.end() };
3566 auto const DL_BEGIN = "<DEVICE_LINK>"_s;
3567 auto const DL_END = "</DEVICE_LINK>"_s;
3568 cm::erase_if(list, [&](std::string const& item) {
3569 return item == DL_BEGIN || item == DL_END;
3570 });
3571
3572 list.insert(list.begin(), static_cast<std::string>(DL_BEGIN));
3573 list.push_back(static_cast<std::string>(DL_END));
3574
3575 return list.to_string();
3576 }
3577
3578 return std::string();
3579 }
3580} deviceLinkNode;
3581
3582namespace {

Callers

nothing calls this directly

Calls 10

reportErrorFunction · 0.85
erase_ifFunction · 0.85
GetOriginalExpressionMethod · 0.80
IsDeviceLinkMethod · 0.80
push_backMethod · 0.80
to_stringMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected