mirror of
https://github.com/Kitware/CMake.git
synced 2026-06-30 19:57:41 +00:00
cmEvaluatedTargetProperty: put declarations in namespace cm
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
struct cmGeneratorExpressionDAGChecker;
|
||||
|
||||
namespace cm {
|
||||
EvaluatedTargetPropertyEntry::EvaluatedTargetPropertyEntry(
|
||||
cmLinkItem const& item, cmListFileBacktrace bt)
|
||||
: LinkItem(item)
|
||||
@@ -107,3 +108,4 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ struct Context;
|
||||
class cmLinkItem;
|
||||
struct cmGeneratorExpressionDAGChecker;
|
||||
|
||||
namespace cm {
|
||||
// Represent a target property entry after evaluating generator expressions
|
||||
// and splitting up lists.
|
||||
struct EvaluatedTargetPropertyEntry
|
||||
@@ -82,3 +83,4 @@ void AddInterfaceEntries(
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
IncludeRuntimeInterface searchRuntime,
|
||||
cmGeneratorTarget::UseTo usage = cmGeneratorTarget::UseTo::Compile);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ std::string AddLangSpecificInterfaceIncludeDirectories(
|
||||
void AddLangSpecificImplicitIncludeDirectories(
|
||||
cmGeneratorTarget const* target, std::string const& lang,
|
||||
std::string const& config, std::string const& propertyName,
|
||||
IncludeDirectoryFallBack mode, EvaluatedTargetPropertyEntries& entries)
|
||||
IncludeDirectoryFallBack mode, cm::EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
if (auto const* libraries =
|
||||
target->GetLinkImplementationLibraries(config, UseTo::Compile)) {
|
||||
@@ -113,7 +113,7 @@ void AddLangSpecificImplicitIncludeDirectories(
|
||||
}
|
||||
if (cm::contains(dependency->GetAllConfigCompileLanguages(), lang)) {
|
||||
auto* lg = dependency->GetLocalGenerator();
|
||||
EvaluatedTargetPropertyEntry entry{ library, library.Backtrace };
|
||||
cm::EvaluatedTargetPropertyEntry entry{ library, library.Backtrace };
|
||||
|
||||
if (lang == "Swift") {
|
||||
entry.Values.emplace_back(
|
||||
@@ -141,12 +141,12 @@ void AddLangSpecificImplicitIncludeDirectories(
|
||||
}
|
||||
|
||||
void processIncludeDirectories(cmGeneratorTarget const* tgt,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
cm::EvaluatedTargetPropertyEntries& entries,
|
||||
std::vector<BT<std::string>>& includes,
|
||||
std::unordered_set<std::string>& uniqueIncludes,
|
||||
bool debugIncludes)
|
||||
{
|
||||
for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
|
||||
for (cm::EvaluatedTargetPropertyEntry& entry : entries.Entries) {
|
||||
cmLinkItem const& item = entry.LinkItem;
|
||||
std::string const& targetName = item.AsStr();
|
||||
bool const fromImported = item.Target && item.Target->IsImported();
|
||||
@@ -237,8 +237,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
|
||||
|
||||
this->DebugIncludesDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->IncludeDirectoriesEntries);
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->IncludeDirectoriesEntries);
|
||||
|
||||
if (lang == "Swift") {
|
||||
AddLangSpecificImplicitIncludeDirectories(
|
||||
@@ -266,7 +267,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
|
||||
}
|
||||
|
||||
AddInterfaceEntries(this, "INTERFACE_INCLUDE_DIRECTORIES", context,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
&dagChecker, entries, cm::IncludeRuntimeInterface::Yes);
|
||||
|
||||
processIncludeDirectories(this, entries, includes, uniqueIncludes,
|
||||
debugIncludes);
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
|
||||
namespace {
|
||||
void processLinkDirectories(cmGeneratorTarget const* tgt,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
cm::EvaluatedTargetPropertyEntries& entries,
|
||||
std::vector<BT<std::string>>& directories,
|
||||
std::unordered_set<std::string>& uniqueDirectories,
|
||||
bool debugDirectories)
|
||||
{
|
||||
for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
|
||||
for (cm::EvaluatedTargetPropertyEntry& entry : entries.Entries) {
|
||||
cmLinkItem const& item = entry.LinkItem;
|
||||
std::string const& targetName = item.AsStr();
|
||||
|
||||
@@ -135,11 +135,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
|
||||
|
||||
this->DebugLinkDirectoriesDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->LinkDirectoriesEntries);
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->LinkDirectoriesEntries);
|
||||
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_DIRECTORIES", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes,
|
||||
entries, cm::IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
@@ -49,14 +49,14 @@ auto const DL_BEGIN = "<DEVICE_LINK>"_s;
|
||||
auto const DL_END = "</DEVICE_LINK>"_s;
|
||||
|
||||
void processOptions(cmGeneratorTarget const* tgt,
|
||||
EvaluatedTargetPropertyEntries const& entries,
|
||||
cm::EvaluatedTargetPropertyEntries const& entries,
|
||||
std::vector<BT<std::string>>& options,
|
||||
std::unordered_set<std::string>& uniqueOptions,
|
||||
bool debugOptions, char const* logName, OptionsParse parse,
|
||||
bool processDeviceOptions = false)
|
||||
{
|
||||
bool splitOption = !processDeviceOptions;
|
||||
for (EvaluatedTargetPropertyEntry const& entry : entries.Entries) {
|
||||
for (cm::EvaluatedTargetPropertyEntry const& entry : entries.Entries) {
|
||||
std::string usedOptions;
|
||||
for (std::string const& opt : entry.Values) {
|
||||
if (processDeviceOptions && (opt == DL_BEGIN || opt == DL_END)) {
|
||||
@@ -222,7 +222,7 @@ constexpr char SBCS_DEFINITION_PREFIX[] = "_SBCS=";
|
||||
|
||||
MsvcCharSetInfo GetMsvcCharSetInfo(
|
||||
cmGeneratorTarget const& tgt, std::string const& lang,
|
||||
EvaluatedTargetPropertyEntries const& entries)
|
||||
cm::EvaluatedTargetPropertyEntries const& entries)
|
||||
{
|
||||
using MsvcCharSet = cmGeneratorTarget::MsvcCharSet;
|
||||
|
||||
@@ -235,7 +235,7 @@ MsvcCharSetInfo GetMsvcCharSetInfo(
|
||||
return { MsvcCharSet::None, false };
|
||||
}
|
||||
|
||||
for (EvaluatedTargetPropertyEntry const& entry : entries.Entries) {
|
||||
for (cm::EvaluatedTargetPropertyEntry const& entry : entries.Entries) {
|
||||
for (std::string const& value : entry.Values) {
|
||||
MsvcCharSet charSet = cmGeneratorTarget::GetMsvcCharSet(value);
|
||||
if (charSet != MsvcCharSet::None) {
|
||||
@@ -289,11 +289,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
|
||||
|
||||
this->DebugCompileOptionsDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->CompileOptionsEntries);
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->CompileOptionsEntries);
|
||||
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_OPTIONS", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes);
|
||||
entries, cm::IncludeRuntimeInterface::Yes);
|
||||
|
||||
processOptions(this, entries, result, uniqueOptions, debugOptions,
|
||||
"compile options", OptionsParse::Shell);
|
||||
@@ -332,11 +333,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
|
||||
|
||||
this->DebugCompileFeaturesDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->CompileFeaturesEntries);
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->CompileFeaturesEntries);
|
||||
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_FEATURES", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes);
|
||||
entries, cm::IncludeRuntimeInterface::Yes);
|
||||
|
||||
processOptions(this, entries, result, uniqueFeatures, debugFeatures,
|
||||
"compile features", OptionsParse::None);
|
||||
@@ -382,11 +384,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
|
||||
|
||||
this->DebugCompileDefinitionsDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->CompileDefinitionsEntries);
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->CompileDefinitionsEntries);
|
||||
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_DEFINITIONS", context,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
&dagChecker, entries, cm::IncludeRuntimeInterface::Yes);
|
||||
|
||||
// Add the character set definition
|
||||
MsvcCharSetInfo charSetInfo = GetMsvcCharSetInfo(*this, language, entries);
|
||||
@@ -449,11 +452,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
|
||||
|
||||
this->DebugPrecompileHeadersDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->PrecompileHeadersEntries);
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->PrecompileHeadersEntries);
|
||||
|
||||
AddInterfaceEntries(this, "INTERFACE_PRECOMPILE_HEADERS", context,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
&dagChecker, entries, cm::IncludeRuntimeInterface::Yes);
|
||||
|
||||
std::vector<BT<std::string>> list;
|
||||
processOptions(this, entries, list, uniqueOptions, debugDefines,
|
||||
@@ -507,11 +511,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
|
||||
|
||||
this->DebugLinkOptionsDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->LinkOptionsEntries);
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->LinkOptionsEntries);
|
||||
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_OPTIONS", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes,
|
||||
entries, cm::IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
@@ -684,12 +689,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
|
||||
this, "STATIC_LIBRARY_OPTIONS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntries entries;
|
||||
cm::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, context, &dagChecker, *entry));
|
||||
cm::EvaluateTargetPropertyEntry(this, context, &dagChecker, *entry));
|
||||
}
|
||||
processOptions(this, entries, result, uniqueOptions, false,
|
||||
"static library link options", OptionsParse::Shell);
|
||||
@@ -729,7 +734,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
|
||||
this, "LINK_DEPENDS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntries entries;
|
||||
cm::EvaluatedTargetPropertyEntries entries;
|
||||
if (cmValue linkDepends = this->GetProperty("LINK_DEPENDS")) {
|
||||
cmList depends{ *linkDepends };
|
||||
for (auto const& depend : depends) {
|
||||
@@ -740,7 +745,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
|
||||
}
|
||||
}
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_DEPENDS", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes,
|
||||
entries, cm::IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
@@ -53,7 +53,7 @@ using UseTo = cmGeneratorTarget::UseTo;
|
||||
void AddObjectEntries(cmGeneratorTarget const* headTarget,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries)
|
||||
cm::EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
headTarget->GetLinkImplementationLibraries(context.Config,
|
||||
@@ -73,7 +73,7 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
|
||||
ge.Parse(std::move(genex));
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
|
||||
EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
|
||||
cm::EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
|
||||
cmExpandList(cge->Evaluate(context, dagChecker, headTarget),
|
||||
ee.Values);
|
||||
if (cge->GetHadContextSensitiveCondition()) {
|
||||
@@ -89,7 +89,7 @@ void AddFileSetEntries(cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorFileSets const* fileSets,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries)
|
||||
cm::EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
auto sources = fileSets->GetSources(context, headTarget, dagChecker);
|
||||
entries =
|
||||
@@ -97,7 +97,7 @@ void AddFileSetEntries(cmGeneratorTarget const* headTarget,
|
||||
}
|
||||
|
||||
bool processSources(cmGeneratorTarget const* tgt, std::string const& config,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
cm::EvaluatedTargetPropertyEntries& entries,
|
||||
std::vector<BT<std::string>>& srcs,
|
||||
std::unordered_set<std::string>& uniqueSrcs,
|
||||
bool debugSources,
|
||||
@@ -107,7 +107,7 @@ bool processSources(cmGeneratorTarget const* tgt, std::string const& config,
|
||||
|
||||
bool contextDependent = entries.HadContextSensitiveCondition;
|
||||
|
||||
for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
|
||||
for (cm::EvaluatedTargetPropertyEntry& entry : entries.Entries) {
|
||||
if (entry.ContextDependent) {
|
||||
contextDependent = true;
|
||||
}
|
||||
@@ -213,18 +213,19 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
this, "SOURCES", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->SourceEntries);
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->SourceEntries);
|
||||
|
||||
std::unordered_set<std::string> uniqueSrcs;
|
||||
bool contextDependentDirectSources =
|
||||
processSources(this, config, entries, files, uniqueSrcs, debugSources);
|
||||
|
||||
// Collect INTERFACE_SOURCES of all direct link-dependencies.
|
||||
EvaluatedTargetPropertyEntries linkInterfaceSourcesEntries;
|
||||
AddInterfaceEntries(this, "INTERFACE_SOURCES", context, &dagChecker,
|
||||
linkInterfaceSourcesEntries, IncludeRuntimeInterface::No,
|
||||
UseTo::Compile);
|
||||
cm::EvaluatedTargetPropertyEntries linkInterfaceSourcesEntries;
|
||||
cm::AddInterfaceEntries(this, "INTERFACE_SOURCES", context, &dagChecker,
|
||||
linkInterfaceSourcesEntries,
|
||||
cm::IncludeRuntimeInterface::No, UseTo::Compile);
|
||||
bool contextDependentInterfaceSources =
|
||||
processSources(this, config, linkInterfaceSourcesEntries, files,
|
||||
uniqueSrcs, debugSources);
|
||||
@@ -232,7 +233,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
// Collect TARGET_OBJECTS of direct object link-dependencies.
|
||||
bool contextDependentObjects = false;
|
||||
if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
|
||||
EvaluatedTargetPropertyEntries linkObjectsEntries;
|
||||
cm::EvaluatedTargetPropertyEntries linkObjectsEntries;
|
||||
AddObjectEntries(this, context, &dagChecker, linkObjectsEntries);
|
||||
contextDependentObjects = processSources(this, config, linkObjectsEntries,
|
||||
files, uniqueSrcs, debugSources);
|
||||
@@ -243,7 +244,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
}
|
||||
|
||||
// Collect this target's file sets.
|
||||
EvaluatedTargetPropertyEntries fileSetEntries;
|
||||
cm::EvaluatedTargetPropertyEntries fileSetEntries;
|
||||
AddFileSetEntries(this, this->FileSets.get(), context, &dagChecker,
|
||||
fileSetEntries);
|
||||
auto processFileSetEntry = [this, &config](cmSourceFile* sf) {
|
||||
|
||||
@@ -1999,7 +1999,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
info.SetBool("MOC_RELAXED_MODE", this->Moc.RelaxedMode);
|
||||
info.SetBool("MOC_PATH_PREFIX", this->Moc.PathPrefix);
|
||||
|
||||
EvaluatedTargetPropertyEntries InterfaceAutoMocMacroNamesEntries;
|
||||
cm::EvaluatedTargetPropertyEntries InterfaceAutoMocMacroNamesEntries;
|
||||
|
||||
if (this->MultiConfig) {
|
||||
for (auto const& cfg : this->ConfigsList) {
|
||||
@@ -2008,10 +2008,10 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr, context,
|
||||
};
|
||||
AddInterfaceEntries(this->GenTarget, "INTERFACE_AUTOMOC_MACRO_NAMES",
|
||||
context, &dagChecker,
|
||||
InterfaceAutoMocMacroNamesEntries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
cm::AddInterfaceEntries(
|
||||
this->GenTarget, "INTERFACE_AUTOMOC_MACRO_NAMES", context,
|
||||
&dagChecker, InterfaceAutoMocMacroNamesEntries,
|
||||
cm::IncludeRuntimeInterface::Yes);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -2021,7 +2021,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
};
|
||||
AddInterfaceEntries(
|
||||
this->GenTarget, "INTERFACE_AUTOMOC_MACRO_NAMES", context, &dagChecker,
|
||||
InterfaceAutoMocMacroNamesEntries, IncludeRuntimeInterface::Yes);
|
||||
InterfaceAutoMocMacroNamesEntries, cm::IncludeRuntimeInterface::Yes);
|
||||
}
|
||||
|
||||
for (auto const& entry : InterfaceAutoMocMacroNamesEntries.Entries) {
|
||||
|
||||
Reference in New Issue
Block a user