diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 9ff6d70d4f..1e3b7e9ac4 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -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 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; diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index d51d548988..5926c124e5 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -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 LinkLibraryOverride; @@ -207,7 +210,5 @@ private: std::vector ObjectEntries; size_t ComponentOrderId; - cmTargetLinkLibraryType LinkType; - bool DebugMode; - bool OldLinkDirMode; + bool OldLinkDirMode = false; };