1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-17 15:32:10 +08:00

GenEx: Collect evaluation arguments into local Context structures

This commit is contained in:
Brad King
2025-09-21 11:39:02 -04:00
parent b40a53e931
commit d4d204382f
19 changed files with 255 additions and 187 deletions

View File

@@ -9,6 +9,7 @@
#include <cm/string_view>
#include "cmFileSet.h"
#include "cmGenExContext.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
#include "cmGeneratorTarget.h"
@@ -76,6 +77,8 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
return std::string();
}
cm::GenEx::Context context(tgt->LocalGenerator, this->Config, language);
cmGeneratorExpression ge(*tgt->Makefile->GetCMakeInstance());
std::unique_ptr<cmGeneratorExpressionDAGChecker> parentDagChecker;
@@ -83,16 +86,10 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
// To please constraint checks of DAGChecker, this property must have
// LINK_OPTIONS property as parent
parentDagChecker = cm::make_unique<cmGeneratorExpressionDAGChecker>(
tgt, "LINK_OPTIONS", nullptr, nullptr, tgt->GetLocalGenerator(),
this->Config);
tgt, "LINK_OPTIONS", nullptr, nullptr, context.LG, context.Config);
}
cmGeneratorExpressionDAGChecker dagChecker{
tgt,
propName,
nullptr,
parentDagChecker.get(),
tgt->GetLocalGenerator(),
this->Config,
tgt, propName, nullptr, parentDagChecker.get(), context.LG, context.Config,
};
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
@@ -103,8 +100,8 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
std::string result = cge->Evaluate(tgt->GetLocalGenerator(), this->Config,
&gDummyHead, &dagChecker, tgt, language);
std::string result = cge->Evaluate(context.LG, context.Config, &gDummyHead,
&dagChecker, tgt, context.Language);
std::set<cmGeneratorTarget const*> const& allTargets =
cge->GetAllTargetsSeen();