From 16cc011fa56adae8946916fa457c5a833765002c Mon Sep 17 00:00:00 2001 From: Orkun Tokdemir Date: Tue, 6 Feb 2024 16:02:35 +0100 Subject: cmQtAutoGenGlobalInitializer: Improve Const-correctness --- Source/cmQtAutoGenGlobalInitializer.cxx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 5e2f99f..591c53e 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -49,7 +49,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( bool globalAutoGenTarget = false; bool globalAutoRccTarget = false; { - cmMakefile* makefile = localGen->GetMakefile(); + cmMakefile const* makefile = localGen->GetMakefile(); // Detect global autogen target name if (makefile->IsOn("CMAKE_GLOBAL_AUTOGEN_TARGET")) { std::string targetName = @@ -118,7 +118,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( target->GetSafeProperty(this->kw().AUTORCC_EXECUTABLE); // We support Qt4, Qt5 and Qt6 - auto qtVersion = + auto const qtVersion = cmQtAutoGenInitializer::GetQtVersion(target.get(), mocExec); bool const validQt = (qtVersion.first.Major == 4) || (qtVersion.first.Major == 5) || (qtVersion.first.Major == 6); @@ -167,7 +167,7 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget( { // Test if the target already exists if (localGen->FindGeneratorTargetToUse(name) == nullptr) { - cmMakefile* makefile = localGen->GetMakefile(); + cmMakefile const* makefile = localGen->GetMakefile(); // Create utility target auto cc = cm::make_unique(); @@ -192,9 +192,10 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget( void cmQtAutoGenGlobalInitializer::AddToGlobalAutoGen( cmLocalGenerator* localGen, std::string const& targetName) { - auto it = this->GlobalAutoGenTargets_.find(localGen); + auto const it = this->GlobalAutoGenTargets_.find(localGen); if (it != this->GlobalAutoGenTargets_.end()) { - cmGeneratorTarget* target = localGen->FindGeneratorTargetToUse(it->second); + cmGeneratorTarget const* target = + localGen->FindGeneratorTargetToUse(it->second); if (target != nullptr) { target->Target->AddUtility(targetName, false, localGen->GetMakefile()); } @@ -204,9 +205,10 @@ void cmQtAutoGenGlobalInitializer::AddToGlobalAutoGen( void cmQtAutoGenGlobalInitializer::AddToGlobalAutoRcc( cmLocalGenerator* localGen, std::string const& targetName) { - auto it = this->GlobalAutoRccTargets_.find(localGen); + auto const it = this->GlobalAutoRccTargets_.find(localGen); if (it != this->GlobalAutoRccTargets_.end()) { - cmGeneratorTarget* target = localGen->FindGeneratorTargetToUse(it->second); + cmGeneratorTarget const* target = + localGen->FindGeneratorTargetToUse(it->second); if (target != nullptr) { target->Target->AddUtility(targetName, false, localGen->GetMakefile()); } @@ -216,7 +218,7 @@ void cmQtAutoGenGlobalInitializer::AddToGlobalAutoRcc( cmQtAutoGen::ConfigStrings cmQtAutoGenGlobalInitializer::GetCompilerFeatures( std::string const& generator, cmQtAutoGen::ConfigString const& executable, - std::string& error, bool const isMultiConfig, bool UseBetterGraph) + std::string& error, bool const isMultiConfig, bool const UseBetterGraph) { cmQtAutoGen::ConfigStrings res; if (isMultiConfig && UseBetterGraph) { @@ -275,7 +277,7 @@ cmQtAutoGenGlobalInitializer::GetCompilerFeatures( // Check if we have cached features { - auto it = this->CompilerFeatures_.Default.find(executable.Default); + auto const it = this->CompilerFeatures_.Default.find(executable.Default); if (it != this->CompilerFeatures_.Default.end()) { res.Default = it->second; return res; -- cgit v0.12