mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-02 20:29:49 -05:00
Merge branch 'backport-genex-refactor' into genex-refactor
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include "cmComputeLinkInformation.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
@@ -522,13 +523,13 @@ std::string cmCommonTargetGenerator::GetLinkerLauncher(
|
||||
std::string propName = lang + "_LINKER_LAUNCHER";
|
||||
cmValue launcherProp = this->GeneratorTarget->GetProperty(propName);
|
||||
if (cmNonempty(launcherProp)) {
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this->GeneratorTarget, propName, nullptr, nullptr,
|
||||
this->LocalCommonGenerator, config,
|
||||
};
|
||||
cm::GenEx::Context context(this->LocalCommonGenerator, config, lang);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{ this->GeneratorTarget,
|
||||
propName, nullptr, nullptr,
|
||||
context };
|
||||
std::string evaluatedLinklauncher = cmGeneratorExpression::Evaluate(
|
||||
*launcherProp, this->LocalCommonGenerator, config, this->GeneratorTarget,
|
||||
&dagChecker, this->GeneratorTarget, lang);
|
||||
*launcherProp, context.LG, context.Config, this->GeneratorTarget,
|
||||
&dagChecker, this->GeneratorTarget, context.Language);
|
||||
// Convert ;-delimited list to single string
|
||||
cmList args{ evaluatedLinklauncher, cmList::EmptyElements::Yes };
|
||||
if (!args.empty()) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "cmsys/RegularExpression.hxx"
|
||||
|
||||
#include "cmComputeComponentGraph.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
@@ -599,45 +600,42 @@ std::string const& cmComputeLinkDepends::LinkEntry::DEFAULT =
|
||||
cmLinkItem::DEFAULT;
|
||||
|
||||
cmComputeLinkDepends::cmComputeLinkDepends(cmGeneratorTarget const* target,
|
||||
std::string const& config,
|
||||
std::string const& linkLanguage,
|
||||
std::string config,
|
||||
std::string linkLanguage,
|
||||
LinkLibrariesStrategy strategy)
|
||||
: Target(target)
|
||||
, Makefile(this->Target->Target->GetMakefile())
|
||||
, GlobalGenerator(this->Target->GetLocalGenerator()->GetGlobalGenerator())
|
||||
, CMakeInstance(this->GlobalGenerator->GetCMakeInstance())
|
||||
, Config(config)
|
||||
, Config(std::move(config))
|
||||
, DebugMode(this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE") ||
|
||||
this->Target->GetProperty("LINK_DEPENDS_DEBUG_MODE").IsOn())
|
||||
, LinkLanguage(linkLanguage)
|
||||
, LinkLanguage(std::move(linkLanguage))
|
||||
, LinkType(ComputeLinkType(
|
||||
this->Config, this->Makefile->GetCMakeInstance()->GetDebugConfigs()))
|
||||
, Strategy(strategy)
|
||||
|
||||
{
|
||||
cm::GenEx::Context context(this->Target->LocalGenerator, this->Config,
|
||||
this->LinkLanguage);
|
||||
// target oriented feature override property takes precedence over
|
||||
// global override property
|
||||
cm::string_view lloPrefix = "LINK_LIBRARY_OVERRIDE_"_s;
|
||||
auto const& keys = this->Target->GetPropertyKeys();
|
||||
std::for_each(
|
||||
keys.cbegin(), keys.cend(),
|
||||
[this, &lloPrefix, &config, &linkLanguage](std::string const& key) {
|
||||
[this, &lloPrefix, &context](std::string const& key) {
|
||||
if (cmHasPrefix(key, lloPrefix)) {
|
||||
if (cmValue feature = this->Target->GetProperty(key)) {
|
||||
if (!feature->empty() && key.length() > lloPrefix.length()) {
|
||||
auto item = key.substr(lloPrefix.length());
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this->Target,
|
||||
"LINK_LIBRARY_OVERRIDE",
|
||||
nullptr,
|
||||
nullptr,
|
||||
this->Target->GetLocalGenerator(),
|
||||
config,
|
||||
this->Target->GetBacktrace(),
|
||||
this->Target, "LINK_LIBRARY_OVERRIDE", nullptr, nullptr,
|
||||
context, this->Target->GetBacktrace(),
|
||||
};
|
||||
auto overrideFeature = cmGeneratorExpression::Evaluate(
|
||||
*feature, this->Target->GetLocalGenerator(), config,
|
||||
this->Target, &dagChecker, this->Target, linkLanguage);
|
||||
*feature, context.LG, context.Config, this->Target, &dagChecker,
|
||||
this->Target, context.Language);
|
||||
this->LinkLibraryOverride.emplace(item, overrideFeature);
|
||||
}
|
||||
}
|
||||
@@ -647,17 +645,12 @@ cmComputeLinkDepends::cmComputeLinkDepends(cmGeneratorTarget const* target,
|
||||
if (cmValue linkLibraryOverride =
|
||||
this->Target->GetProperty("LINK_LIBRARY_OVERRIDE")) {
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
target,
|
||||
"LINK_LIBRARY_OVERRIDE",
|
||||
nullptr,
|
||||
nullptr,
|
||||
target->GetLocalGenerator(),
|
||||
config,
|
||||
target->GetBacktrace(),
|
||||
this->Target, "LINK_LIBRARY_OVERRIDE", nullptr, nullptr,
|
||||
context, this->Target->GetBacktrace(),
|
||||
};
|
||||
auto overrideValue = cmGeneratorExpression::Evaluate(
|
||||
*linkLibraryOverride, target->GetLocalGenerator(), config, target,
|
||||
&dagChecker, target, linkLanguage);
|
||||
*linkLibraryOverride, context.LG, context.Config, this->Target,
|
||||
&dagChecker, this->Target, context.Language);
|
||||
|
||||
std::vector<std::string> overrideList =
|
||||
cmTokenize(overrideValue, ',', cmTokenizerMode::New);
|
||||
|
||||
@@ -39,9 +39,8 @@ enum class LinkLibrariesStrategy
|
||||
class cmComputeLinkDepends
|
||||
{
|
||||
public:
|
||||
cmComputeLinkDepends(cmGeneratorTarget const* target,
|
||||
std::string const& config,
|
||||
std::string const& linkLanguage,
|
||||
cmComputeLinkDepends(cmGeneratorTarget const* target, std::string config,
|
||||
std::string linkLanguage,
|
||||
LinkLibrariesStrategy strategy);
|
||||
~cmComputeLinkDepends();
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "cmExportBuildFileGenerator.h"
|
||||
#include "cmExportSet.h"
|
||||
#include "cmFileSet.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorExpression.h" // IWYU pragma: keep
|
||||
#include "cmGeneratorTarget.h"
|
||||
@@ -50,6 +51,7 @@ TdiSourceInfo CollationInformationSources(cmGeneratorTarget const* gt,
|
||||
std::string const& config,
|
||||
cmDyndepGeneratorCallbacks const& cb)
|
||||
{
|
||||
cm::GenEx::Context const context(gt->LocalGenerator, config);
|
||||
TdiSourceInfo info;
|
||||
cmTarget const* tgt = gt->Target;
|
||||
auto all_file_sets = tgt->GetAllFileSetNames();
|
||||
@@ -108,12 +110,12 @@ TdiSourceInfo CollationInformationSources(cmGeneratorTarget const* gt,
|
||||
auto fileEntries = file_set->CompileFileEntries();
|
||||
auto directoryEntries = file_set->CompileDirectoryEntries();
|
||||
|
||||
auto directories = file_set->EvaluateDirectoryEntries(
|
||||
directoryEntries, gt->LocalGenerator, config, gt);
|
||||
auto directories =
|
||||
file_set->EvaluateDirectoryEntries(directoryEntries, context, gt);
|
||||
std::map<std::string, std::vector<std::string>> files_per_dirs;
|
||||
for (auto const& entry : fileEntries) {
|
||||
file_set->EvaluateFileEntry(directories, files_per_dirs, entry,
|
||||
gt->LocalGenerator, config, gt);
|
||||
file_set->EvaluateFileEntry(directories, files_per_dirs, entry, context,
|
||||
gt);
|
||||
}
|
||||
|
||||
Json::Value fs_dest = Json::nullValue;
|
||||
|
||||
@@ -21,14 +21,12 @@ EvaluatedTargetPropertyEntry::EvaluatedTargetPropertyEntry(
|
||||
}
|
||||
|
||||
EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget::TargetPropertyEntry& entry)
|
||||
{
|
||||
EvaluatedTargetPropertyEntry ee(entry.LinkImplItem, entry.GetBacktrace());
|
||||
cmExpandList(entry.Evaluate(thisTarget->GetLocalGenerator(), config,
|
||||
thisTarget, dagChecker, lang),
|
||||
ee.Values);
|
||||
cmExpandList(entry.Evaluate(context, thisTarget, dagChecker), ee.Values);
|
||||
if (entry.GetHadContextSensitiveCondition()) {
|
||||
ee.ContextDependent = true;
|
||||
}
|
||||
@@ -36,24 +34,24 @@ EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
|
||||
}
|
||||
|
||||
EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::vector<std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>> const&
|
||||
in)
|
||||
{
|
||||
EvaluatedTargetPropertyEntries out;
|
||||
out.Entries.reserve(in.size());
|
||||
for (auto const& entry : in) {
|
||||
out.Entries.emplace_back(EvaluateTargetPropertyEntry(
|
||||
thisTarget, config, lang, dagChecker, *entry));
|
||||
out.Entries.emplace_back(
|
||||
EvaluateTargetPropertyEntry(thisTarget, context, dagChecker, *entry));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
namespace {
|
||||
void addInterfaceEntry(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config, std::string const& prop,
|
||||
std::string const& lang,
|
||||
std::string const& prop,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
cmGeneratorTarget::UseTo usage,
|
||||
@@ -65,9 +63,8 @@ void addInterfaceEntry(cmGeneratorTarget const* headTarget,
|
||||
// Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in our
|
||||
// caller's property and hand-evaluate it as if it were compiled.
|
||||
// Create a context as cmCompiledGeneratorExpression::Evaluate does.
|
||||
cm::GenEx::Evaluation eval(
|
||||
cm::GenEx::Context(headTarget->GetLocalGenerator(), config, lang),
|
||||
false, headTarget, headTarget, true, lib.Backtrace);
|
||||
cm::GenEx::Evaluation eval(context, false, headTarget, headTarget, true,
|
||||
lib.Backtrace);
|
||||
cmExpandList(
|
||||
lib.Target->EvaluateInterfaceProperty(prop, &eval, dagChecker, usage),
|
||||
ee.Values);
|
||||
@@ -79,8 +76,8 @@ void addInterfaceEntry(cmGeneratorTarget const* headTarget,
|
||||
}
|
||||
|
||||
void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config, std::string const& prop,
|
||||
std::string const& lang,
|
||||
std::string const& prop,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
IncludeRuntimeInterface searchRuntime,
|
||||
@@ -88,25 +85,26 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
|
||||
{
|
||||
if (searchRuntime == IncludeRuntimeInterface::Yes) {
|
||||
if (cmLinkImplementation const* impl =
|
||||
headTarget->GetLinkImplementation(config, usage)) {
|
||||
headTarget->GetLinkImplementation(context.Config, usage)) {
|
||||
entries.HadContextSensitiveCondition =
|
||||
impl->HadContextSensitiveCondition;
|
||||
|
||||
auto runtimeLibIt = impl->LanguageRuntimeLibraries.find(lang);
|
||||
auto runtimeLibIt =
|
||||
impl->LanguageRuntimeLibraries.find(context.Language);
|
||||
if (runtimeLibIt != impl->LanguageRuntimeLibraries.end()) {
|
||||
addInterfaceEntry(headTarget, config, prop, lang, dagChecker, entries,
|
||||
addInterfaceEntry(headTarget, prop, context, dagChecker, entries,
|
||||
usage, runtimeLibIt->second);
|
||||
}
|
||||
addInterfaceEntry(headTarget, config, prop, lang, dagChecker, entries,
|
||||
usage, impl->Libraries);
|
||||
addInterfaceEntry(headTarget, prop, context, dagChecker, entries, usage,
|
||||
impl->Libraries);
|
||||
}
|
||||
} else {
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
headTarget->GetLinkImplementationLibraries(config, usage)) {
|
||||
headTarget->GetLinkImplementationLibraries(context.Config, usage)) {
|
||||
entries.HadContextSensitiveCondition =
|
||||
impl->HadContextSensitiveCondition;
|
||||
addInterfaceEntry(headTarget, config, prop, lang, dagChecker, entries,
|
||||
usage, impl->Libraries);
|
||||
addInterfaceEntry(headTarget, prop, context, dagChecker, entries, usage,
|
||||
impl->Libraries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmListFileCache.h"
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmLinkImplItem;
|
||||
struct cmGeneratorExpressionDAGChecker;
|
||||
|
||||
@@ -34,8 +40,8 @@ struct EvaluatedTargetPropertyEntry
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget::TargetPropertyEntry& entry);
|
||||
|
||||
struct EvaluatedTargetPropertyEntries
|
||||
@@ -45,8 +51,8 @@ struct EvaluatedTargetPropertyEntries
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::vector<std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>> const&
|
||||
in);
|
||||
|
||||
@@ -71,8 +77,8 @@ enum class IncludeRuntimeInterface
|
||||
};
|
||||
|
||||
void AddInterfaceEntries(
|
||||
cmGeneratorTarget const* headTarget, std::string const& config,
|
||||
std::string const& prop, std::string const& lang,
|
||||
cmGeneratorTarget const* headTarget, std::string const& prop,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
IncludeRuntimeInterface searchRuntime,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "cmCryptoHash.h"
|
||||
#include "cmExportSet.h"
|
||||
#include "cmFileSet.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
@@ -176,8 +177,9 @@ std::string cmExportBuildCMakeConfigGenerator::GetFileSetDirectories(
|
||||
auto directoryEntries = fileSet->CompileDirectoryEntries();
|
||||
|
||||
for (auto const& config : configs) {
|
||||
auto directories = fileSet->EvaluateDirectoryEntries(
|
||||
directoryEntries, gte->LocalGenerator, config, gte);
|
||||
cm::GenEx::Context context(gte->LocalGenerator, config);
|
||||
auto directories =
|
||||
fileSet->EvaluateDirectoryEntries(directoryEntries, context, gte);
|
||||
|
||||
bool const contextSensitive =
|
||||
std::any_of(directoryEntries.begin(), directoryEntries.end(),
|
||||
@@ -226,13 +228,13 @@ std::string cmExportBuildCMakeConfigGenerator::GetFileSetFiles(
|
||||
auto directoryEntries = fileSet->CompileDirectoryEntries();
|
||||
|
||||
for (auto const& config : configs) {
|
||||
auto directories = fileSet->EvaluateDirectoryEntries(
|
||||
directoryEntries, gte->LocalGenerator, config, gte);
|
||||
cm::GenEx::Context context(gte->LocalGenerator, config);
|
||||
auto directories =
|
||||
fileSet->EvaluateDirectoryEntries(directoryEntries, context, gte);
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files;
|
||||
for (auto const& entry : fileEntries) {
|
||||
fileSet->EvaluateFileEntry(directories, files, entry,
|
||||
gte->LocalGenerator, config, gte);
|
||||
fileSet->EvaluateFileEntry(directories, files, entry, context, gte);
|
||||
}
|
||||
|
||||
bool const contextSensitive =
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "cmExportFileGenerator.h"
|
||||
#include "cmExportSet.h"
|
||||
#include "cmFileSet.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
@@ -339,13 +340,13 @@ std::string cmExportInstallCMakeConfigGenerator::GetFileSetFiles(
|
||||
te->FileSetGenerators.at(fileSet->GetName())->GetDestination());
|
||||
|
||||
for (auto const& config : configs) {
|
||||
auto directories = fileSet->EvaluateDirectoryEntries(
|
||||
directoryEntries, gte->LocalGenerator, config, gte);
|
||||
cm::GenEx::Context context(gte->LocalGenerator, config);
|
||||
auto directories =
|
||||
fileSet->EvaluateDirectoryEntries(directoryEntries, context, gte);
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files;
|
||||
for (auto const& entry : fileEntries) {
|
||||
fileSet->EvaluateFileEntry(directories, files, entry,
|
||||
gte->LocalGenerator, config, gte);
|
||||
fileSet->EvaluateFileEntry(directories, files, entry, context, gte);
|
||||
}
|
||||
auto unescapedDest = destCge->Evaluate(gte->LocalGenerator, config, gte);
|
||||
auto dest =
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
tgt,
|
||||
propName,
|
||||
nullptr,
|
||||
parentDagChecker.get(),
|
||||
tgt->GetLocalGenerator(),
|
||||
this->Config,
|
||||
tgt, propName, nullptr, parentDagChecker.get(), context,
|
||||
};
|
||||
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
|
||||
@@ -103,8 +100,7 @@ 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, &dagChecker, &gDummyHead, tgt);
|
||||
|
||||
std::set<cmGeneratorTarget const*> const& allTargets =
|
||||
cge->GetAllTargetsSeen();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "cmExportSet.h"
|
||||
#include "cmFileAPI.h"
|
||||
#include "cmFileSet.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
@@ -1100,16 +1101,15 @@ Json::Value DirectoryObject::DumpInstaller(cmInstallGenerator* gen)
|
||||
|
||||
auto* target = installFileSet->GetTarget();
|
||||
|
||||
cm::GenEx::Context context(target->LocalGenerator, this->Config);
|
||||
|
||||
auto dirCges = fileSet->CompileDirectoryEntries();
|
||||
auto dirs = fileSet->EvaluateDirectoryEntries(
|
||||
dirCges, target->GetLocalGenerator(), this->Config, target);
|
||||
auto dirs = fileSet->EvaluateDirectoryEntries(dirCges, context, target);
|
||||
|
||||
auto entryCges = fileSet->CompileFileEntries();
|
||||
std::map<std::string, std::vector<std::string>> entries;
|
||||
for (auto const& entryCge : entryCges) {
|
||||
fileSet->EvaluateFileEntry(dirs, entries, entryCge,
|
||||
target->GetLocalGenerator(), this->Config,
|
||||
target);
|
||||
fileSet->EvaluateFileEntry(dirs, entries, entryCge, context, target);
|
||||
}
|
||||
|
||||
Json::Value files = Json::arrayValue;
|
||||
@@ -1633,18 +1633,19 @@ std::pair<Json::Value, Target::FileSetDatabase> Target::DumpFileSets()
|
||||
continue;
|
||||
}
|
||||
|
||||
cm::GenEx::Context context(this->GT->LocalGenerator, this->Config);
|
||||
|
||||
auto fileEntries = fs->CompileFileEntries();
|
||||
auto directoryEntries = fs->CompileDirectoryEntries();
|
||||
|
||||
auto directories = fs->EvaluateDirectoryEntries(
|
||||
directoryEntries, this->GT->LocalGenerator, this->Config, this->GT);
|
||||
auto directories =
|
||||
fs->EvaluateDirectoryEntries(directoryEntries, context, this->GT);
|
||||
|
||||
fsJson.append(this->DumpFileSet(fs, directories));
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files_per_dirs;
|
||||
for (auto const& entry : fileEntries) {
|
||||
fs->EvaluateFileEntry(directories, files_per_dirs, entry,
|
||||
this->GT->LocalGenerator, this->Config,
|
||||
fs->EvaluateFileEntry(directories, files_per_dirs, entry, context,
|
||||
this->GT);
|
||||
}
|
||||
|
||||
|
||||
+10
-11
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "cmsys/RegularExpression.hxx"
|
||||
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
@@ -156,8 +157,7 @@ cmFileSet::CompileDirectoryEntries() const
|
||||
|
||||
std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
|
||||
std::vector<std::unique_ptr<cmCompiledGeneratorExpression>> const& cges,
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* target,
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* target,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const
|
||||
{
|
||||
struct DirCacheEntry
|
||||
@@ -169,11 +169,11 @@ std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
|
||||
std::unordered_map<std::string, DirCacheEntry> dirCache;
|
||||
std::vector<std::string> result;
|
||||
for (auto const& cge : cges) {
|
||||
auto entry = cge->Evaluate(lg, config, target, dagChecker);
|
||||
auto entry = cge->Evaluate(context, dagChecker, target);
|
||||
cmList dirs{ entry };
|
||||
for (std::string dir : dirs) {
|
||||
if (!cmSystemTools::FileIsFullPath(dir)) {
|
||||
dir = cmStrCat(lg->GetCurrentSourceDirectory(), '/', dir);
|
||||
dir = cmStrCat(context.LG->GetCurrentSourceDirectory(), '/', dir);
|
||||
}
|
||||
|
||||
auto dirCacheResult = dirCache.emplace(dir, DirCacheEntry());
|
||||
@@ -198,7 +198,7 @@ std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
|
||||
priorDirCacheEntry.collapsedDir) ||
|
||||
cmSystemTools::IsSubDirectory(priorDirCacheEntry.collapsedDir,
|
||||
dirCacheEntry.collapsedDir))) {
|
||||
lg->GetCMakeInstance()->IssueMessage(
|
||||
context.LG->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat(
|
||||
"Base directories in file set cannot be subdirectories of each "
|
||||
@@ -218,14 +218,13 @@ void cmFileSet::EvaluateFileEntry(
|
||||
std::vector<std::string> const& dirs,
|
||||
std::map<std::string, std::vector<std::string>>& filesPerDir,
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> const& cge,
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* target,
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* target,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const
|
||||
{
|
||||
auto files = cge->Evaluate(lg, config, target, dagChecker);
|
||||
auto files = cge->Evaluate(context, dagChecker, target);
|
||||
for (std::string file : cmList{ files }) {
|
||||
if (!cmSystemTools::FileIsFullPath(file)) {
|
||||
file = cmStrCat(lg->GetCurrentSourceDirectory(), '/', file);
|
||||
file = cmStrCat(context.LG->GetCurrentSourceDirectory(), '/', file);
|
||||
}
|
||||
auto collapsedFile = cmSystemTools::CollapseFullPath(file);
|
||||
bool found = false;
|
||||
@@ -246,8 +245,8 @@ void cmFileSet::EvaluateFileEntry(
|
||||
for (auto const& dir : dirs) {
|
||||
e << "\n " << dir;
|
||||
}
|
||||
lg->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str(),
|
||||
cge->GetBacktrace());
|
||||
context.LG->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::FATAL_ERROR, e.str(), cge->GetBacktrace());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+8
-5
@@ -12,10 +12,15 @@
|
||||
|
||||
#include "cmListFileCache.h"
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmCompiledGeneratorExpression;
|
||||
struct cmGeneratorExpressionDAGChecker;
|
||||
class cmGeneratorTarget;
|
||||
class cmLocalGenerator;
|
||||
class cmMakefile;
|
||||
class cmake;
|
||||
|
||||
@@ -67,16 +72,14 @@ public:
|
||||
|
||||
std::vector<std::string> EvaluateDirectoryEntries(
|
||||
std::vector<std::unique_ptr<cmCompiledGeneratorExpression>> const& cges,
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* target,
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* target,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const;
|
||||
|
||||
void EvaluateFileEntry(
|
||||
std::vector<std::string> const& dirs,
|
||||
std::map<std::string, std::vector<std::string>>& filesPerDir,
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> const& cge,
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* target,
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* target,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const;
|
||||
|
||||
static bool IsValidName(std::string const& name);
|
||||
|
||||
@@ -55,22 +55,29 @@ std::string cmGeneratorExpression::Evaluate(
|
||||
"genex_compile_eval", input);
|
||||
#endif
|
||||
|
||||
cm::GenEx::Context context(lg, config, language);
|
||||
cmCompiledGeneratorExpression cge(*lg->GetCMakeInstance(),
|
||||
cmListFileBacktrace(), std::move(input));
|
||||
return cge.Evaluate(lg, config, headTarget, dagChecker, currentTarget,
|
||||
language);
|
||||
return cge.Evaluate(context, dagChecker, headTarget, currentTarget);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
std::string const& cmCompiledGeneratorExpression::Evaluate(
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* currentTarget, std::string const& language) const
|
||||
cmGeneratorTarget const* headTarget) const
|
||||
{
|
||||
cm::GenEx::Evaluation eval(cm::GenEx::Context(lg, config, language),
|
||||
this->Quiet, headTarget,
|
||||
cm::GenEx::Context context(lg, config);
|
||||
return this->Evaluate(context, nullptr, headTarget);
|
||||
}
|
||||
|
||||
std::string const& cmCompiledGeneratorExpression::Evaluate(
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorTarget const* currentTarget) const
|
||||
{
|
||||
cm::GenEx::Evaluation eval(context, this->Quiet, headTarget,
|
||||
currentTarget ? currentTarget : headTarget,
|
||||
this->EvaluateForBuildsystem, this->Backtrace);
|
||||
|
||||
@@ -453,17 +460,18 @@ std::string const& cmGeneratorExpressionInterpreter::Evaluate(
|
||||
this->CompiledGeneratorExpression =
|
||||
this->GeneratorExpression.Parse(std::move(expression));
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, this->Config,
|
||||
this->Language);
|
||||
|
||||
// Specify COMPILE_OPTIONS to DAGchecker, same semantic as COMPILE_FLAGS
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this->HeadTarget,
|
||||
property == "COMPILE_FLAGS" ? "COMPILE_OPTIONS" : property,
|
||||
nullptr,
|
||||
nullptr,
|
||||
this->LocalGenerator,
|
||||
this->Config,
|
||||
context,
|
||||
};
|
||||
|
||||
return this->CompiledGeneratorExpression->Evaluate(
|
||||
this->LocalGenerator, this->Config, this->HeadTarget, &dagChecker, nullptr,
|
||||
this->Language);
|
||||
return this->CompiledGeneratorExpression->Evaluate(context, &dagChecker,
|
||||
this->HeadTarget);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmake;
|
||||
class cmCompiledGeneratorExpression;
|
||||
class cmGeneratorTarget;
|
||||
@@ -104,10 +110,13 @@ public:
|
||||
|
||||
std::string const& Evaluate(
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget = nullptr) const;
|
||||
|
||||
std::string const& Evaluate(
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* headTarget = nullptr,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
|
||||
cmGeneratorTarget const* currentTarget = nullptr,
|
||||
std::string const& language = std::string()) const;
|
||||
cmGeneratorTarget const* currentTarget = nullptr) const;
|
||||
|
||||
/** Get set of targets found during evaluations. */
|
||||
std::set<cmGeneratorTarget*> const& GetTargets() const
|
||||
|
||||
@@ -21,9 +21,8 @@
|
||||
cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
|
||||
cmGeneratorTarget const* target, std::string property,
|
||||
GeneratorExpressionContent const* content,
|
||||
cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG,
|
||||
std::string const& contextConfig, cmListFileBacktrace backtrace,
|
||||
ComputingLinkLibraries computingLinkLibraries)
|
||||
cmGeneratorExpressionDAGChecker* parent, cm::GenEx::Context const& context,
|
||||
cmListFileBacktrace backtrace, ComputingLinkLibraries computingLinkLibraries)
|
||||
: Parent(parent)
|
||||
, Top(parent ? parent->Top : this)
|
||||
, Target(target)
|
||||
@@ -37,7 +36,8 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
|
||||
} else {
|
||||
this->TopIsTransitiveProperty =
|
||||
this->Target
|
||||
->IsTransitiveProperty(this->Property, contextLG, contextConfig, this)
|
||||
->IsTransitiveProperty(this->Property, context.LG, context.Config,
|
||||
this)
|
||||
.has_value();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
struct Evaluation;
|
||||
}
|
||||
}
|
||||
|
||||
struct GeneratorExpressionContent;
|
||||
class cmGeneratorTarget;
|
||||
class cmLocalGenerator;
|
||||
|
||||
struct cmGeneratorExpressionDAGChecker
|
||||
{
|
||||
@@ -30,8 +30,7 @@ struct cmGeneratorExpressionDAGChecker
|
||||
cmGeneratorExpressionDAGChecker(
|
||||
cmGeneratorTarget const* target, std::string property,
|
||||
GeneratorExpressionContent const* content,
|
||||
cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG,
|
||||
std::string const& contextConfig,
|
||||
cmGeneratorExpressionDAGChecker* parent, cm::GenEx::Context const& context,
|
||||
cmListFileBacktrace backtrace = cmListFileBacktrace(),
|
||||
ComputingLinkLibraries computingLinkLibraries =
|
||||
ComputingLinkLibraries::No);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "cmsys/FStream.hxx"
|
||||
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmListFileCache.h"
|
||||
@@ -39,11 +40,12 @@ void cmGeneratorExpressionEvaluationFile::Generate(
|
||||
cmCompiledGeneratorExpression* inputExpression,
|
||||
std::map<std::string, std::string>& outputFiles, mode_t perm)
|
||||
{
|
||||
cm::GenEx::Context context(lg, config, lang);
|
||||
std::string rawCondition = this->Condition->GetInput();
|
||||
cmGeneratorTarget* target = lg->FindGeneratorTargetToUse(this->Target);
|
||||
if (!rawCondition.empty()) {
|
||||
std::string condResult =
|
||||
this->Condition->Evaluate(lg, config, target, nullptr, nullptr, lang);
|
||||
this->Condition->Evaluate(context, nullptr, target);
|
||||
if (condResult == "0") {
|
||||
return;
|
||||
}
|
||||
@@ -58,10 +60,9 @@ void cmGeneratorExpressionEvaluationFile::Generate(
|
||||
}
|
||||
}
|
||||
|
||||
std::string const outputFileName =
|
||||
this->GetOutputFileName(lg, target, config, lang);
|
||||
std::string const outputFileName = this->GetOutputFileName(context, target);
|
||||
std::string const& outputContent =
|
||||
inputExpression->Evaluate(lg, config, target, nullptr, nullptr, lang);
|
||||
inputExpression->Evaluate(context, nullptr, target);
|
||||
|
||||
auto it = outputFiles.find(outputFileName);
|
||||
|
||||
@@ -123,8 +124,9 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
|
||||
cmGeneratorTarget* target = lg->FindGeneratorTargetToUse(this->Target);
|
||||
gg->GetEnabledLanguages(enabledLanguages);
|
||||
|
||||
for (std::string const& le : enabledLanguages) {
|
||||
std::string const name = this->GetOutputFileName(lg, target, config, le);
|
||||
for (std::string const& lang : enabledLanguages) {
|
||||
cm::GenEx::Context context(lg, config, lang);
|
||||
std::string const name = this->GetOutputFileName(context, target);
|
||||
cmSourceFile* sf = lg->GetMakefile()->GetOrCreateGeneratedSource(name);
|
||||
|
||||
// Tell the build system generators that there is no build rule
|
||||
@@ -204,16 +206,16 @@ std::string cmGeneratorExpressionEvaluationFile::GetInputFileName(
|
||||
}
|
||||
|
||||
std::string cmGeneratorExpressionEvaluationFile::GetOutputFileName(
|
||||
cmLocalGenerator const* lg, cmGeneratorTarget* target,
|
||||
std::string const& config, std::string const& lang)
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget* target)
|
||||
{
|
||||
std::string outputFileName =
|
||||
this->OutputFileExpr->Evaluate(lg, config, target, nullptr, nullptr, lang);
|
||||
this->OutputFileExpr->Evaluate(context, nullptr, target);
|
||||
|
||||
if (cmSystemTools::FileIsFullPath(outputFileName)) {
|
||||
outputFileName = cmSystemTools::CollapseFullPath(outputFileName);
|
||||
} else {
|
||||
outputFileName = this->FixRelativePath(outputFileName, PathForOutput, lg);
|
||||
outputFileName =
|
||||
this->FixRelativePath(outputFileName, PathForOutput, context.LG);
|
||||
}
|
||||
|
||||
return outputFileName;
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmPolicies.h"
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmGeneratorTarget;
|
||||
class cmLocalGenerator;
|
||||
|
||||
@@ -40,10 +46,8 @@ private:
|
||||
std::map<std::string, std::string>& outputFiles, mode_t perm);
|
||||
|
||||
std::string GetInputFileName(cmLocalGenerator const* lg);
|
||||
std::string GetOutputFileName(cmLocalGenerator const* lg,
|
||||
cmGeneratorTarget* target,
|
||||
std::string const& config,
|
||||
std::string const& lang);
|
||||
std::string GetOutputFileName(cm::GenEx::Context const& context,
|
||||
cmGeneratorTarget* target);
|
||||
enum PathRole
|
||||
{
|
||||
PathForInput,
|
||||
|
||||
@@ -64,8 +64,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
|
||||
cge->SetEvaluateForBuildsystem(eval->EvaluateForBuildsystem);
|
||||
cge->SetQuiet(eval->Quiet);
|
||||
std::string result =
|
||||
cge->Evaluate(eval->Context.LG, eval->Context.Config, headTarget,
|
||||
dagChecker, currentTarget, eval->Context.Language);
|
||||
cge->Evaluate(eval->Context, dagChecker, headTarget, currentTarget);
|
||||
if (cge->GetHadContextSensitiveCondition()) {
|
||||
eval->HadContextSensitiveCondition = true;
|
||||
}
|
||||
@@ -481,8 +480,7 @@ protected:
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
eval->HeadTarget, genexOperator + ":" + expression,
|
||||
content, dagCheckerParent,
|
||||
eval->Context.LG, eval->Context.Config,
|
||||
eval->Backtrace,
|
||||
eval->Context, eval->Backtrace,
|
||||
};
|
||||
switch (dagChecker.Check()) {
|
||||
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
|
||||
@@ -3136,9 +3134,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||
}
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
target, propertyName, content,
|
||||
dagCheckerParent, eval->Context.LG, eval->Context.Config,
|
||||
eval->Backtrace,
|
||||
target, propertyName, content,
|
||||
dagCheckerParent, eval->Context, eval->Backtrace,
|
||||
};
|
||||
|
||||
switch (dagChecker.Check()) {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "cmExperimental.h"
|
||||
#include "cmFileSet.h"
|
||||
#include "cmFileTimes.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
@@ -632,7 +633,7 @@ std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
|
||||
}
|
||||
|
||||
namespace {
|
||||
void handleSystemIncludesDep(cmLocalGenerator* lg,
|
||||
void handleSystemIncludesDep(cmLocalGenerator const* lg,
|
||||
cmGeneratorTarget const* depTgt,
|
||||
std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
@@ -739,12 +740,13 @@ std::string cmGeneratorTarget::GetLinkerTypeProperty(
|
||||
std::string propName{ "LINKER_TYPE" };
|
||||
auto linkerType = this->GetProperty(propName);
|
||||
if (!linkerType.IsEmpty()) {
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, lang);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, propName, nullptr, nullptr, this->LocalGenerator, config,
|
||||
this, propName, nullptr, nullptr, context,
|
||||
};
|
||||
auto ltype =
|
||||
cmGeneratorExpression::Evaluate(*linkerType, this->GetLocalGenerator(),
|
||||
config, this, &dagChecker, this, lang);
|
||||
auto ltype = cmGeneratorExpression::Evaluate(
|
||||
*linkerType, context.LG, context.Config, this, &dagChecker, this,
|
||||
context.Language);
|
||||
if (this->IsDeviceLink()) {
|
||||
cmList list{ ltype };
|
||||
auto const DL_BEGIN = "<DEVICE_LINK>"_s;
|
||||
@@ -1208,24 +1210,25 @@ void cmGeneratorTarget::AddSystemIncludeCacheKey(
|
||||
std::string const& key, std::string const& config,
|
||||
std::string const& language) const
|
||||
{
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, language);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "SYSTEM_INCLUDE_DIRECTORIES", nullptr,
|
||||
nullptr, this->LocalGenerator, config,
|
||||
this, "SYSTEM_INCLUDE_DIRECTORIES", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
bool excludeImported = this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED");
|
||||
|
||||
cmList result;
|
||||
for (std::string const& it : this->Target->GetSystemIncludeDirectories()) {
|
||||
result.append(cmGeneratorExpression::Evaluate(
|
||||
it, this->LocalGenerator, config, this, &dagChecker, nullptr, language));
|
||||
result.append(
|
||||
cmGeneratorExpression::Evaluate(it, context.LG, context.Config, this,
|
||||
&dagChecker, nullptr, context.Language));
|
||||
}
|
||||
|
||||
std::vector<cmGeneratorTarget const*> const& deps =
|
||||
this->GetLinkImplementationClosure(config, UseTo::Compile);
|
||||
for (cmGeneratorTarget const* dep : deps) {
|
||||
handleSystemIncludesDep(this->LocalGenerator, dep, config, this,
|
||||
&dagChecker, result, excludeImported, language);
|
||||
handleSystemIncludesDep(context.LG, dep, context.Config, this, &dagChecker,
|
||||
result, excludeImported, context.Language);
|
||||
}
|
||||
|
||||
cmLinkImplementation const* impl =
|
||||
@@ -1235,9 +1238,9 @@ void cmGeneratorTarget::AddSystemIncludeCacheKey(
|
||||
if (runtimeEntries != impl->LanguageRuntimeLibraries.end()) {
|
||||
for (auto const& lib : runtimeEntries->second) {
|
||||
if (lib.Target) {
|
||||
handleSystemIncludesDep(this->LocalGenerator, lib.Target, config,
|
||||
this, &dagChecker, result, excludeImported,
|
||||
language);
|
||||
handleSystemIncludesDep(context.LG, lib.Target, context.Config, this,
|
||||
&dagChecker, result, excludeImported,
|
||||
context.Language);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1998,11 +2001,12 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
|
||||
return;
|
||||
}
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "AUTOUIC_OPTIONS", nullptr, nullptr, this->LocalGenerator, config,
|
||||
this, "AUTOUIC_OPTIONS", nullptr, nullptr, context,
|
||||
};
|
||||
cmExpandList(cmGeneratorExpression::Evaluate(prop, this->LocalGenerator,
|
||||
config, this, &dagChecker),
|
||||
cmExpandList(cmGeneratorExpression::Evaluate(
|
||||
prop, context.LG, context.Config, this, &dagChecker),
|
||||
result);
|
||||
}
|
||||
|
||||
@@ -5665,17 +5669,17 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
|
||||
bool first = true;
|
||||
for (auto const& config : this->Makefile->GetGeneratorConfigs(
|
||||
cmMakefile::GeneratorConfigQuery::IncludeEmptyConfig)) {
|
||||
cm::GenEx::Context context(this->LocalGenerator, config);
|
||||
if (first || dirCgesContextSensitive) {
|
||||
dirs = fileSet->EvaluateDirectoryEntries(dirCges, this->LocalGenerator,
|
||||
config, this);
|
||||
dirs = fileSet->EvaluateDirectoryEntries(dirCges, context, this);
|
||||
dirCgesContextSensitive =
|
||||
std::any_of(dirCges.begin(), dirCges.end(), contextSensitive);
|
||||
}
|
||||
if (first || fileCgesContextSensitive) {
|
||||
filesPerDir.clear();
|
||||
for (auto const& fileCge : fileCges) {
|
||||
fileSet->EvaluateFileEntry(dirs, filesPerDir, fileCge,
|
||||
this->LocalGenerator, config, this);
|
||||
fileSet->EvaluateFileEntry(dirs, filesPerDir, fileCge, context,
|
||||
this);
|
||||
if (fileCge->GetHadContextSensitiveCondition()) {
|
||||
fileCgesContextSensitive = true;
|
||||
}
|
||||
@@ -6208,15 +6212,16 @@ void cmGeneratorTarget::BuildFileSetInfoCache(std::string const& config) const
|
||||
continue;
|
||||
}
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config);
|
||||
|
||||
auto fileEntries = file_set->CompileFileEntries();
|
||||
auto directoryEntries = file_set->CompileDirectoryEntries();
|
||||
auto directories = file_set->EvaluateDirectoryEntries(
|
||||
directoryEntries, this->LocalGenerator, config, this);
|
||||
auto directories =
|
||||
file_set->EvaluateDirectoryEntries(directoryEntries, context, this);
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files;
|
||||
for (auto const& entry : fileEntries) {
|
||||
file_set->EvaluateFileEntry(directories, files, entry,
|
||||
this->LocalGenerator, config, this);
|
||||
file_set->EvaluateFileEntry(directories, files, entry, context, this);
|
||||
}
|
||||
|
||||
for (auto const& it : files) {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
struct Evaluation;
|
||||
}
|
||||
}
|
||||
@@ -1566,10 +1567,8 @@ public:
|
||||
cmFileSet const* fileSet, cmLinkImplItem const& item = NoLinkImplItem);
|
||||
|
||||
virtual std::string const& Evaluate(
|
||||
cmLocalGenerator* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::string const& language) const = 0;
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const = 0;
|
||||
|
||||
virtual cmListFileBacktrace GetBacktrace() const = 0;
|
||||
virtual std::string const& GetInput() const = 0;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <cmext/algorithm>
|
||||
|
||||
#include "cmEvaluatedTargetProperty.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmLinkItem.h"
|
||||
@@ -44,16 +45,12 @@ std::string AddLangSpecificInterfaceIncludeDirectories(
|
||||
cmGeneratorTarget const* root, cmGeneratorTarget const* target,
|
||||
std::string const& lang, std::string const& config,
|
||||
std::string const& propertyName, IncludeDirectoryFallBack mode,
|
||||
cmGeneratorExpressionDAGChecker* context)
|
||||
cmGeneratorExpressionDAGChecker* dagCheckerParent)
|
||||
{
|
||||
cm::GenEx::Context context(target->LocalGenerator, config);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
target,
|
||||
propertyName,
|
||||
nullptr,
|
||||
context,
|
||||
target->GetLocalGenerator(),
|
||||
config,
|
||||
target->GetBacktrace(),
|
||||
target, propertyName, nullptr,
|
||||
dagCheckerParent, context, target->GetBacktrace(),
|
||||
};
|
||||
switch (dagChecker.Check()) {
|
||||
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
|
||||
@@ -103,14 +100,9 @@ void AddLangSpecificImplicitIncludeDirectories(
|
||||
{
|
||||
if (auto const* libraries =
|
||||
target->GetLinkImplementationLibraries(config, UseTo::Compile)) {
|
||||
cm::GenEx::Context context(target->LocalGenerator, config, lang);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
target,
|
||||
propertyName,
|
||||
nullptr,
|
||||
nullptr,
|
||||
target->GetLocalGenerator(),
|
||||
config,
|
||||
target->GetBacktrace(),
|
||||
target, propertyName, nullptr, nullptr, context, target->GetBacktrace(),
|
||||
};
|
||||
|
||||
for (cmLinkImplItem const& library : libraries->Libraries) {
|
||||
@@ -137,8 +129,8 @@ void AddLangSpecificImplicitIncludeDirectories(
|
||||
}
|
||||
|
||||
cmExpandList(AddLangSpecificInterfaceIncludeDirectories(
|
||||
target, dependency, lang, config, propertyName, mode,
|
||||
&dagChecker),
|
||||
target, dependency, context.Language, context.Config,
|
||||
propertyName, mode, &dagChecker),
|
||||
entry.Values);
|
||||
entries.Entries.emplace_back(std::move(entry));
|
||||
}
|
||||
@@ -231,9 +223,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
|
||||
std::vector<BT<std::string>> includes;
|
||||
std::unordered_set<std::string> uniqueIncludes;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, lang);
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "INCLUDE_DIRECTORIES", nullptr,
|
||||
nullptr, this->LocalGenerator, config,
|
||||
this, "INCLUDE_DIRECTORIES", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
cmList debugProperties{ this->Makefile->GetDefinition(
|
||||
@@ -244,7 +237,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
|
||||
this->DebugIncludesDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, config, lang, &dagChecker, this->IncludeDirectoriesEntries);
|
||||
this, context, &dagChecker, this->IncludeDirectoriesEntries);
|
||||
|
||||
if (lang == "Swift") {
|
||||
AddLangSpecificImplicitIncludeDirectories(
|
||||
@@ -271,7 +264,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
|
||||
entries);
|
||||
}
|
||||
|
||||
AddInterfaceEntries(this, config, "INTERFACE_INCLUDE_DIRECTORIES", lang,
|
||||
AddInterfaceEntries(this, "INTERFACE_INCLUDE_DIRECTORIES", context,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
processIncludeDirectories(this, entries, includes, uniqueIncludes,
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "cmAlgorithms.h"
|
||||
#include "cmComputeLinkInformation.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
@@ -541,13 +542,14 @@ void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
|
||||
return;
|
||||
}
|
||||
// Keep this logic in sync with ComputeLinkImplementationLibraries.
|
||||
cm::GenEx::Context context(this->LocalGenerator, config,
|
||||
headTarget->LinkerLanguage);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this,
|
||||
prop,
|
||||
nullptr,
|
||||
nullptr,
|
||||
this->LocalGenerator,
|
||||
config,
|
||||
context,
|
||||
cmListFileBacktrace(),
|
||||
cmGeneratorExpressionDAGChecker::ComputingLinkLibraries::Yes,
|
||||
};
|
||||
@@ -565,9 +567,7 @@ void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
|
||||
entry.Backtrace);
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(entry.Value);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
cmList libs{ cge->Evaluate(this->LocalGenerator, config, headTarget,
|
||||
&dagChecker, this,
|
||||
headTarget->LinkerLanguage) };
|
||||
cmList libs{ cge->Evaluate(context, &dagChecker, headTarget, this) };
|
||||
|
||||
auto linkFeature = cmLinkItem::DEFAULT;
|
||||
for (auto const& lib : libs) {
|
||||
@@ -1133,6 +1133,8 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
||||
std::string const& config, cmOptionalLinkImplementation& impl,
|
||||
UseTo usage) const
|
||||
{
|
||||
cm::GenEx::Context context(this->LocalGenerator, config,
|
||||
this->LinkerLanguage);
|
||||
cmLocalGenerator const* lg = this->LocalGenerator;
|
||||
cmMakefile const* mf = lg->GetMakefile();
|
||||
cmBTStringRange entryRange = this->Target->GetLinkImplementationEntries();
|
||||
@@ -1145,8 +1147,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
||||
"LINK_LIBRARIES",
|
||||
nullptr,
|
||||
nullptr,
|
||||
this->LocalGenerator,
|
||||
config,
|
||||
context,
|
||||
cmListFileBacktrace(),
|
||||
cmGeneratorExpressionDAGChecker::ComputingLinkLibraries::Yes,
|
||||
};
|
||||
@@ -1168,9 +1169,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> const cge =
|
||||
ge.Parse(entry.Value);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
std::string const& evaluated =
|
||||
cge->Evaluate(this->LocalGenerator, config, this, &dagChecker, nullptr,
|
||||
this->LinkerLanguage);
|
||||
std::string const& evaluated = cge->Evaluate(context, &dagChecker, this);
|
||||
cmList llibs(evaluated);
|
||||
if (cge->GetHadHeadSensitiveCondition()) {
|
||||
impl.HadHeadSensitiveCondition = true;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <cmext/algorithm>
|
||||
|
||||
#include "cmEvaluatedTargetProperty.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
#include "cmLinkItem.h"
|
||||
#include "cmList.h"
|
||||
@@ -122,8 +123,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
|
||||
std::vector<BT<std::string>> result;
|
||||
std::unordered_set<std::string> uniqueDirectories;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, language);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "LINK_DIRECTORIES", nullptr, nullptr, this->LocalGenerator, config,
|
||||
this, "LINK_DIRECTORIES", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
cmList debugProperties{ this->Makefile->GetDefinition(
|
||||
@@ -134,10 +136,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
|
||||
this->DebugLinkDirectoriesDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, config, language, &dagChecker, this->LinkDirectoriesEntries);
|
||||
this, context, &dagChecker, this->LinkDirectoriesEntries);
|
||||
|
||||
AddInterfaceEntries(this, config, "INTERFACE_LINK_DIRECTORIES", language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes,
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_DIRECTORIES", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include "cmEvaluatedTargetProperty.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
@@ -230,8 +231,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
|
||||
std::vector<BT<std::string>> result;
|
||||
std::unordered_set<std::string> uniqueOptions;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, language);
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "COMPILE_OPTIONS", nullptr, nullptr, this->LocalGenerator, config,
|
||||
this, "COMPILE_OPTIONS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
cmList debugProperties{ this->Makefile->GetDefinition(
|
||||
@@ -242,10 +245,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
|
||||
this->DebugCompileOptionsDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, config, language, &dagChecker, this->CompileOptionsEntries);
|
||||
this, context, &dagChecker, this->CompileOptionsEntries);
|
||||
|
||||
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_OPTIONS", language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_OPTIONS", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
processOptions(this, entries, result, uniqueOptions, debugOptions,
|
||||
"compile options", OptionsParse::Shell);
|
||||
@@ -270,8 +273,11 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
|
||||
std::vector<BT<std::string>> result;
|
||||
std::unordered_set<std::string> uniqueFeatures;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config,
|
||||
/*language=*/std::string());
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "COMPILE_FEATURES", nullptr, nullptr, this->LocalGenerator, config,
|
||||
this, "COMPILE_FEATURES", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
cmList debugProperties{ this->Makefile->GetDefinition(
|
||||
@@ -282,11 +288,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
|
||||
this->DebugCompileFeaturesDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, config, std::string(), &dagChecker, this->CompileFeaturesEntries);
|
||||
this, context, &dagChecker, this->CompileFeaturesEntries);
|
||||
|
||||
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_FEATURES",
|
||||
std::string(), &dagChecker, entries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_FEATURES", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
processOptions(this, entries, result, uniqueFeatures, debugFeatures,
|
||||
"compile features", OptionsParse::None);
|
||||
@@ -319,9 +324,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
|
||||
std::vector<BT<std::string>> list;
|
||||
std::unordered_set<std::string> uniqueOptions;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, language);
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "COMPILE_DEFINITIONS", nullptr,
|
||||
nullptr, this->LocalGenerator, config,
|
||||
this, "COMPILE_DEFINITIONS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
cmList debugProperties{ this->Makefile->GetDefinition(
|
||||
@@ -332,9 +338,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
|
||||
this->DebugCompileDefinitionsDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, config, language, &dagChecker, this->CompileDefinitionsEntries);
|
||||
this, context, &dagChecker, this->CompileDefinitionsEntries);
|
||||
|
||||
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_DEFINITIONS", language,
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_DEFINITIONS", context,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
processOptions(this, entries, list, uniqueOptions, debugDefines,
|
||||
@@ -356,8 +362,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
|
||||
}
|
||||
std::unordered_set<std::string> uniqueOptions;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, language);
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "PRECOMPILE_HEADERS", nullptr, nullptr, this->LocalGenerator, config,
|
||||
this, "PRECOMPILE_HEADERS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
cmList debugProperties{ this->Makefile->GetDefinition(
|
||||
@@ -369,9 +377,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
|
||||
this->DebugPrecompileHeadersDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, config, language, &dagChecker, this->PrecompileHeadersEntries);
|
||||
this, context, &dagChecker, this->PrecompileHeadersEntries);
|
||||
|
||||
AddInterfaceEntries(this, config, "INTERFACE_PRECOMPILE_HEADERS", language,
|
||||
AddInterfaceEntries(this, "INTERFACE_PRECOMPILE_HEADERS", context,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
std::vector<BT<std::string>> list;
|
||||
@@ -413,8 +421,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
|
||||
std::vector<BT<std::string>> result;
|
||||
std::unordered_set<std::string> uniqueOptions;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, language);
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "LINK_OPTIONS", nullptr, nullptr, this->LocalGenerator, config,
|
||||
this, "LINK_OPTIONS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
cmList debugProperties{ this->Makefile->GetDefinition(
|
||||
@@ -425,10 +435,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
|
||||
this->DebugLinkOptionsDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, config, language, &dagChecker, this->LinkOptionsEntries);
|
||||
this, context, &dagChecker, this->LinkOptionsEntries);
|
||||
|
||||
AddInterfaceEntries(this, config, "INTERFACE_LINK_OPTIONS", language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes,
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_OPTIONS", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
@@ -595,17 +605,18 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
|
||||
std::vector<BT<std::string>> result;
|
||||
std::unordered_set<std::string> uniqueOptions;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, language);
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "STATIC_LIBRARY_OPTIONS", nullptr,
|
||||
nullptr, this->LocalGenerator, config,
|
||||
this, "STATIC_LIBRARY_OPTIONS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntries entries;
|
||||
if (cmValue linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
|
||||
std::unique_ptr<TargetPropertyEntry> entry = TargetPropertyEntry::Create(
|
||||
*this->LocalGenerator->GetCMakeInstance(), *linkOptions);
|
||||
entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
|
||||
this, config, language, &dagChecker, *entry));
|
||||
entries.Entries.emplace_back(
|
||||
EvaluateTargetPropertyEntry(this, context, &dagChecker, *entry));
|
||||
}
|
||||
processOptions(this, entries, result, uniqueOptions, false,
|
||||
"static library link options", OptionsParse::Shell);
|
||||
@@ -640,8 +651,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
|
||||
{
|
||||
std::vector<BT<std::string>> result;
|
||||
std::unordered_set<std::string> uniqueOptions;
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, language);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "LINK_DEPENDS", nullptr, nullptr, this->LocalGenerator, config,
|
||||
this, "LINK_DEPENDS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntries entries;
|
||||
@@ -650,12 +662,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
|
||||
for (auto const& depend : depends) {
|
||||
std::unique_ptr<TargetPropertyEntry> entry = TargetPropertyEntry::Create(
|
||||
*this->LocalGenerator->GetCMakeInstance(), depend);
|
||||
entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
|
||||
this, config, language, &dagChecker, *entry));
|
||||
entries.Entries.emplace_back(
|
||||
EvaluateTargetPropertyEntry(this, context, &dagChecker, *entry));
|
||||
}
|
||||
}
|
||||
AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS", language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes,
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_DEPENDS", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "cmAlgorithms.h"
|
||||
#include "cmEvaluatedTargetProperty.h"
|
||||
#include "cmFileSet.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
@@ -46,12 +47,13 @@ namespace {
|
||||
using UseTo = cmGeneratorTarget::UseTo;
|
||||
|
||||
void AddObjectEntries(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
headTarget->GetLinkImplementationLibraries(config, UseTo::Link)) {
|
||||
headTarget->GetLinkImplementationLibraries(context.Config,
|
||||
UseTo::Link)) {
|
||||
entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
|
||||
for (cmLinkImplItem const& lib : impl->Libraries) {
|
||||
if (lib.Target &&
|
||||
@@ -66,8 +68,7 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
|
||||
EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
|
||||
cmExpandList(cge->Evaluate(headTarget->GetLocalGenerator(), config,
|
||||
headTarget, dagChecker),
|
||||
cmExpandList(cge->Evaluate(context, dagChecker, headTarget),
|
||||
ee.Values);
|
||||
if (cge->GetHadContextSensitiveCondition()) {
|
||||
ee.ContextDependent = true;
|
||||
@@ -79,14 +80,14 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
|
||||
}
|
||||
|
||||
void addFileSetEntry(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmFileSet const* fileSet,
|
||||
EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
auto dirCges = fileSet->CompileDirectoryEntries();
|
||||
auto dirs = fileSet->EvaluateDirectoryEntries(
|
||||
dirCges, headTarget->GetLocalGenerator(), config, headTarget, dagChecker);
|
||||
auto dirs = fileSet->EvaluateDirectoryEntries(dirCges, context, headTarget,
|
||||
dagChecker);
|
||||
bool contextSensitiveDirs = false;
|
||||
for (auto const& dirCge : dirCges) {
|
||||
if (dirCge->GetHadContextSensitiveCondition()) {
|
||||
@@ -100,7 +101,7 @@ void addFileSetEntry(cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorTarget::TargetPropertyEntry::CreateFileSet(
|
||||
dirs, contextSensitiveDirs, std::move(entryCge), fileSet);
|
||||
entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
|
||||
headTarget, config, "", dagChecker, *targetPropEntry));
|
||||
headTarget, context, dagChecker, *targetPropEntry));
|
||||
EvaluatedTargetPropertyEntry const& entry = entries.Entries.back();
|
||||
for (auto const& file : entry.Values) {
|
||||
auto* sf = headTarget->Makefile->GetOrCreateSource(file);
|
||||
@@ -140,20 +141,20 @@ void addFileSetEntry(cmGeneratorTarget const* headTarget,
|
||||
}
|
||||
|
||||
void AddFileSetEntries(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
for (auto const& entry : headTarget->Target->GetHeaderSetsEntries()) {
|
||||
for (auto const& name : cmList{ entry.Value }) {
|
||||
auto const* headerSet = headTarget->Target->GetFileSet(name);
|
||||
addFileSetEntry(headTarget, config, dagChecker, headerSet, entries);
|
||||
addFileSetEntry(headTarget, context, dagChecker, headerSet, entries);
|
||||
}
|
||||
}
|
||||
for (auto const& entry : headTarget->Target->GetCxxModuleSetsEntries()) {
|
||||
for (auto const& name : cmList{ entry.Value }) {
|
||||
auto const* cxxModuleSet = headTarget->Target->GetFileSet(name);
|
||||
addFileSetEntry(headTarget, config, dagChecker, cxxModuleSet, entries);
|
||||
addFileSetEntry(headTarget, context, dagChecker, cxxModuleSet, entries);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,12 +242,15 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
|
||||
this->DebugSourcesDone = true;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config,
|
||||
/*language=*/std::string());
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "SOURCES", nullptr, nullptr, this->LocalGenerator, config,
|
||||
this, "SOURCES", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, config, std::string(), &dagChecker, this->SourceEntries);
|
||||
this, context, &dagChecker, this->SourceEntries);
|
||||
|
||||
std::unordered_set<std::string> uniqueSrcs;
|
||||
bool contextDependentDirectSources =
|
||||
@@ -254,9 +258,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
|
||||
// Collect INTERFACE_SOURCES of all direct link-dependencies.
|
||||
EvaluatedTargetPropertyEntries linkInterfaceSourcesEntries;
|
||||
AddInterfaceEntries(this, config, "INTERFACE_SOURCES", std::string(),
|
||||
&dagChecker, linkInterfaceSourcesEntries,
|
||||
IncludeRuntimeInterface::No, UseTo::Compile);
|
||||
AddInterfaceEntries(this, "INTERFACE_SOURCES", context, &dagChecker,
|
||||
linkInterfaceSourcesEntries, IncludeRuntimeInterface::No,
|
||||
UseTo::Compile);
|
||||
bool contextDependentInterfaceSources = processSources(
|
||||
this, linkInterfaceSourcesEntries, files, uniqueSrcs, debugSources);
|
||||
|
||||
@@ -264,7 +268,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
bool contextDependentObjects = false;
|
||||
if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
|
||||
EvaluatedTargetPropertyEntries linkObjectsEntries;
|
||||
AddObjectEntries(this, config, &dagChecker, linkObjectsEntries);
|
||||
AddObjectEntries(this, context, &dagChecker, linkObjectsEntries);
|
||||
contextDependentObjects = processSources(this, linkObjectsEntries, files,
|
||||
uniqueSrcs, debugSources);
|
||||
// Note that for imported targets or multi-config generators supporting
|
||||
@@ -275,7 +279,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
|
||||
// Collect this target's file sets.
|
||||
EvaluatedTargetPropertyEntries fileSetEntries;
|
||||
AddFileSetEntries(this, config, &dagChecker, fileSetEntries);
|
||||
AddFileSetEntries(this, context, &dagChecker, fileSetEntries);
|
||||
bool contextDependentFileSets =
|
||||
processSources(this, fileSetEntries, files, uniqueSrcs, debugSources);
|
||||
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
|
||||
class cmLocalGenerator;
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmake;
|
||||
struct cmGeneratorExpressionDAGChecker;
|
||||
|
||||
@@ -33,10 +38,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::string const& Evaluate(cmLocalGenerator*, std::string const&,
|
||||
std::string const& Evaluate(cm::GenEx::Context const&,
|
||||
cmGeneratorTarget const*,
|
||||
cmGeneratorExpressionDAGChecker*,
|
||||
std::string const&) const override
|
||||
cmGeneratorExpressionDAGChecker*) const override
|
||||
{
|
||||
return this->PropertyValue.Value;
|
||||
}
|
||||
@@ -64,13 +68,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::string const& Evaluate(cmLocalGenerator* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::string const& language) const override
|
||||
std::string const& Evaluate(
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const override
|
||||
{
|
||||
return this->ge->Evaluate(lg, config, headTarget, dagChecker, nullptr,
|
||||
language);
|
||||
return this->ge->Evaluate(context, dagChecker, headTarget);
|
||||
}
|
||||
|
||||
cmListFileBacktrace GetBacktrace() const override
|
||||
@@ -105,14 +107,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::string const& Evaluate(cmLocalGenerator* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::string const& /*lang*/) const override
|
||||
std::string const& Evaluate(
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const override
|
||||
{
|
||||
std::map<std::string, std::vector<std::string>> filesPerDir;
|
||||
this->FileSet->EvaluateFileEntry(this->BaseDirs, filesPerDir,
|
||||
this->EntryCge, lg, config, headTarget,
|
||||
this->EntryCge, context, headTarget,
|
||||
dagChecker);
|
||||
|
||||
std::vector<std::string> files;
|
||||
|
||||
@@ -112,13 +112,7 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
|
||||
// a subset of TargetPropertyNode::Evaluate without stringify/parse steps
|
||||
// but sufficient for transitive interface properties.
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this,
|
||||
prop,
|
||||
nullptr,
|
||||
dagCheckerParent,
|
||||
eval->Context.LG,
|
||||
eval->Context.Config,
|
||||
eval->Backtrace,
|
||||
this, prop, nullptr, dagCheckerParent, eval->Context, eval->Backtrace,
|
||||
};
|
||||
switch (dagChecker.Check()) {
|
||||
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include "cmFileSet.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
@@ -122,14 +123,16 @@ cmInstallFileSetGenerator::CalculateFilesPerDir(
|
||||
{
|
||||
std::map<std::string, std::vector<std::string>> result;
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config);
|
||||
|
||||
auto dirCges = this->FileSet->CompileDirectoryEntries();
|
||||
auto dirs = this->FileSet->EvaluateDirectoryEntries(
|
||||
dirCges, this->LocalGenerator, config, this->Target);
|
||||
auto dirs =
|
||||
this->FileSet->EvaluateDirectoryEntries(dirCges, context, this->Target);
|
||||
|
||||
auto fileCges = this->FileSet->CompileFileEntries();
|
||||
for (auto const& fileCge : fileCges) {
|
||||
this->FileSet->EvaluateFileEntry(
|
||||
dirs, result, fileCge, this->LocalGenerator, config, this->Target);
|
||||
this->FileSet->EvaluateFileEntry(dirs, result, fileCge, context,
|
||||
this->Target);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "cmCustomCommand.h"
|
||||
#include "cmCustomCommandGenerator.h"
|
||||
#include "cmFileSet.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorOptions.h"
|
||||
@@ -205,6 +206,7 @@ void cmMakefileTargetGenerator::CreateRuleFile()
|
||||
|
||||
void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||
{
|
||||
cm::GenEx::Context context(this->LocalGenerator, this->GetConfigName());
|
||||
this->GeneratorTarget->CheckCxxModuleStatus(this->GetConfigName());
|
||||
|
||||
// -- Write the custom commands for this target
|
||||
@@ -362,13 +364,11 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||
auto fileEntries = file_set->CompileFileEntries();
|
||||
auto directoryEntries = file_set->CompileDirectoryEntries();
|
||||
auto directories = file_set->EvaluateDirectoryEntries(
|
||||
directoryEntries, this->LocalGenerator, this->GetConfigName(),
|
||||
this->GeneratorTarget);
|
||||
directoryEntries, context, this->GeneratorTarget);
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files;
|
||||
for (auto const& entry : fileEntries) {
|
||||
file_set->EvaluateFileEntry(directories, files, entry,
|
||||
this->LocalGenerator, this->GetConfigName(),
|
||||
file_set->EvaluateFileEntry(directories, files, entry, context,
|
||||
this->GeneratorTarget);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "cmCustomCommand.h"
|
||||
#include "cmCustomCommandLines.h"
|
||||
#include "cmEvaluatedTargetProperty.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
@@ -1977,25 +1978,24 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
if (this->MultiConfig) {
|
||||
for (auto const& cfg : this->ConfigsList) {
|
||||
if (!cfg.empty()) {
|
||||
cm::GenEx::Context context(this->LocalGen, cfg, "CXX");
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr,
|
||||
nullptr, this->LocalGen, cfg,
|
||||
this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr, context,
|
||||
};
|
||||
AddInterfaceEntries(this->GenTarget, cfg,
|
||||
"INTERFACE_AUTOMOC_MACRO_NAMES", "CXX",
|
||||
&dagChecker, InterfaceAutoMocMacroNamesEntries,
|
||||
AddInterfaceEntries(this->GenTarget, "INTERFACE_AUTOMOC_MACRO_NAMES",
|
||||
context, &dagChecker,
|
||||
InterfaceAutoMocMacroNamesEntries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cm::GenEx::Context context(this->LocalGen, this->ConfigDefault, "CXX");
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr,
|
||||
nullptr, this->LocalGen, this->ConfigDefault,
|
||||
this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr, context,
|
||||
};
|
||||
AddInterfaceEntries(this->GenTarget, this->ConfigDefault,
|
||||
"INTERFACE_AUTOMOC_MACRO_NAMES", "CXX", &dagChecker,
|
||||
InterfaceAutoMocMacroNamesEntries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(
|
||||
this->GenTarget, "INTERFACE_AUTOMOC_MACRO_NAMES", context, &dagChecker,
|
||||
InterfaceAutoMocMacroNamesEntries, IncludeRuntimeInterface::Yes);
|
||||
}
|
||||
|
||||
for (auto const& entry : InterfaceAutoMocMacroNamesEntries.Entries) {
|
||||
|
||||
Reference in New Issue
Block a user