1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-22 07:25:02 +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,
const std::string& config,
const std::string& linkLanguage)
{
// Store context information.
this->Target = target;
this->Makefile = this->Target->Target->GetMakefile();
this->GlobalGenerator =
this->Target->GetLocalGenerator()->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
this->LinkLanguage = linkLanguage;
: Target(target)
, Makefile(this->Target->Target->GetMakefile())
, GlobalGenerator(this->Target->GetLocalGenerator()->GetGlobalGenerator())
, CMakeInstance(this->GlobalGenerator->GetCMakeInstance())
, Config(config)
, DebugMode(this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE"))
, LinkLanguage(linkLanguage)
, LinkType(CMP0003_ComputeLinkType(
this->Config, this->Makefile->GetCMakeInstance()->GetDebugConfigs()))
{
// target oriented feature override property takes precedence over
// global override property
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;

View File

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