cmGeneratorExpressionNode: Factor out local variable for global generator

This commit is contained in:
Brad King
2021-07-20 14:50:13 -04:00
parent 31ecd37180
commit 83c8272280

View File

@@ -1635,10 +1635,11 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
}
if (!context->EvaluateForBuildsystem) {
cmGlobalGenerator* gg = context->LG->GetGlobalGenerator();
cmGlobalGenerator* gg = context->LG->GetGlobalGenerator();
{
std::string reason;
if (!gg->HasKnownObjectFileLocation(&reason)) {
if (!context->EvaluateForBuildsystem &&
!gg->HasKnownObjectFileLocation(&reason)) {
std::ostringstream e;
e << "The evaluation of the TARGET_OBJECTS generator expression "
"is only suitable for consumption by CMake (limited"