1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-23 00:48:55 +08:00

cmComputeLinkDepends: Modernize member initialization

This commit is contained in:
Brad King
2024-09-18 13:58:54 -04:00
parent 8db69c767b
commit 3bd73fcc76
2 changed files with 18 additions and 30 deletions

View File

@@ -580,15 +580,17 @@ std::string const& cmComputeLinkDepends::LinkEntry::DEFAULT =
cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target, cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
const std::string& config, const std::string& config,
const std::string& linkLanguage) const std::string& linkLanguage)
{ : Target(target)
// Store context information. , Makefile(this->Target->Target->GetMakefile())
this->Target = target; , GlobalGenerator(this->Target->GetLocalGenerator()->GetGlobalGenerator())
this->Makefile = this->Target->Target->GetMakefile(); , CMakeInstance(this->GlobalGenerator->GetCMakeInstance())
this->GlobalGenerator = , Config(config)
this->Target->GetLocalGenerator()->GetGlobalGenerator(); , DebugMode(this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE"))
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); , LinkLanguage(linkLanguage)
this->LinkLanguage = linkLanguage; , LinkType(CMP0003_ComputeLinkType(
this->Config, this->Makefile->GetCMakeInstance()->GetDebugConfigs()))
{
// target oriented feature override property takes precedence over // target oriented feature override property takes precedence over
// global override property // global override property
cm::string_view lloPrefix = "LINK_LIBRARY_OVERRIDE_"_s; cm::string_view lloPrefix = "LINK_LIBRARY_OVERRIDE_"_s;
@@ -640,21 +642,6 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
}); });
} }
} }
// The configuration being linked.
this->Config = config;
std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
this->LinkType = CMP0003_ComputeLinkType(this->Config, debugConfigs);
// Enable debug mode if requested.
this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE");
// Assume no compatibility until set.
this->OldLinkDirMode = false;
// No computation has been done.
this->CCG = nullptr;
} }
cmComputeLinkDepends::~cmComputeLinkDepends() = default; cmComputeLinkDepends::~cmComputeLinkDepends() = default;

View File

@@ -86,12 +86,15 @@ public:
private: private:
// Context information. // Context information.
cmGeneratorTarget const* Target; cmGeneratorTarget const* Target = nullptr;
cmMakefile* Makefile; cmMakefile* Makefile = nullptr;
cmGlobalGenerator const* GlobalGenerator; cmGlobalGenerator const* GlobalGenerator = nullptr;
cmake* CMakeInstance; cmake* CMakeInstance;
std::string LinkLanguage;
std::string Config; std::string Config;
bool DebugMode = false;
std::string LinkLanguage;
cmTargetLinkLibraryType LinkType;
EntryVector FinalLinkEntries; EntryVector FinalLinkEntries;
std::map<std::string, std::string> LinkLibraryOverride; std::map<std::string, std::string> LinkLibraryOverride;
@@ -207,7 +210,5 @@ private:
std::vector<size_t> ObjectEntries; std::vector<size_t> ObjectEntries;
size_t ComponentOrderId; size_t ComponentOrderId;
cmTargetLinkLibraryType LinkType; bool OldLinkDirMode = false;
bool DebugMode;
bool OldLinkDirMode;
}; };