Browse Source

export: Fix const placement

Use clang-format to fix placement of const qualifiers to be consistently
right of the typename. The inconsistency was getting annoying,
especially as the following refactor changes a lot of methods and
sometimes adds const. (Being inconsistent within a file is not ideal,
but in some cases there was inconsistency within single lines!)
Matthew Woehlke 1 year ago
parent
commit
6c66340a64

+ 9 - 9
Source/cmExportAndroidMKGenerator.cxx

@@ -27,7 +27,7 @@ cmExportAndroidMKGenerator::cmExportAndroidMKGenerator()
 }
 
 void cmExportAndroidMKGenerator::GenerateImportHeaderCode(std::ostream& os,
-                                                          const std::string&)
+                                                          std::string const&)
 {
   os << "LOCAL_PATH := $(call my-dir)\n\n";
 }
@@ -37,7 +37,7 @@ void cmExportAndroidMKGenerator::GenerateImportFooterCode(std::ostream&)
 }
 
 void cmExportAndroidMKGenerator::GenerateExpectedTargetsCode(
-  std::ostream&, const std::string&)
+  std::ostream&, std::string const&)
 {
 }
 
@@ -57,8 +57,8 @@ void cmExportAndroidMKGenerator::GenerateImportTargetCode(
 }
 
 void cmExportAndroidMKGenerator::GenerateImportPropertyCode(
-  std::ostream&, const std::string&, const std::string&,
-  cmGeneratorTarget const*, ImportPropertyMap const&, const std::string&)
+  std::ostream&, std::string const&, std::string const&,
+  cmGeneratorTarget const*, ImportPropertyMap const&, std::string const&)
 {
 }
 
@@ -67,8 +67,8 @@ void cmExportAndroidMKGenerator::GenerateMissingTargetsCheckCode(std::ostream&)
 }
 
 void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
-  const cmGeneratorTarget* target, std::ostream& os,
-  const ImportPropertyMap& properties)
+  cmGeneratorTarget const* target, std::ostream& os,
+  ImportPropertyMap const& properties)
 {
   std::string config;
   if (!this->Configurations.empty()) {
@@ -79,11 +79,11 @@ void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
 }
 
 void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
-  const cmGeneratorTarget* target, std::ostream& os,
-  const ImportPropertyMap& properties, GenerateType type,
+  cmGeneratorTarget const* target, std::ostream& os,
+  ImportPropertyMap const& properties, GenerateType type,
   std::string const& config)
 {
-  const bool newCMP0022Behavior =
+  bool const newCMP0022Behavior =
     target->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
     target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
   if (!newCMP0022Behavior) {

+ 6 - 6
Source/cmExportAndroidMKGenerator.h

@@ -34,7 +34,7 @@ public:
   };
   static void GenerateInterfaceProperties(cmGeneratorTarget const* target,
                                           std::ostream& os,
-                                          const ImportPropertyMap& properties,
+                                          ImportPropertyMap const& properties,
                                           GenerateType type,
                                           std::string const& config);
 
@@ -43,20 +43,20 @@ protected:
   void GeneratePolicyHeaderCode(std::ostream&) override {}
   void GeneratePolicyFooterCode(std::ostream&) override {}
   void GenerateImportHeaderCode(std::ostream& os,
-                                const std::string& config = "") override;
+                                std::string const& config = "") override;
   void GenerateImportFooterCode(std::ostream& os) override;
   void GenerateImportTargetCode(
     std::ostream& os, cmGeneratorTarget const* target,
     cmStateEnums::TargetType /*targetType*/) override;
   void GenerateExpectedTargetsCode(
-    std::ostream& os, const std::string& expectedTargets) override;
+    std::ostream& os, std::string const& expectedTargets) override;
   void GenerateImportPropertyCode(
-    std::ostream& os, const std::string& config, const std::string& suffix,
+    std::ostream& os, std::string const& config, std::string const& suffix,
     cmGeneratorTarget const* target, ImportPropertyMap const& properties,
-    const std::string& importedXcFrameworkLocation) override;
+    std::string const& importedXcFrameworkLocation) override;
   void GenerateMissingTargetsCheckCode(std::ostream& os) override;
   void GenerateFindDependencyCalls(std::ostream&) override {}
   void GenerateInterfaceProperties(
     cmGeneratorTarget const* target, std::ostream& os,
-    const ImportPropertyMap& properties) override;
+    ImportPropertyMap const& properties) override;
 };

+ 9 - 9
Source/cmExportBuildAndroidMKGenerator.cxx

@@ -27,7 +27,7 @@ cmExportBuildAndroidMKGenerator::cmExportBuildAndroidMKGenerator()
 }
 
 void cmExportBuildAndroidMKGenerator::GenerateImportHeaderCode(
-  std::ostream& os, const std::string&)
+  std::ostream& os, std::string const&)
 {
   os << "LOCAL_PATH := $(call my-dir)\n\n";
 }
@@ -37,7 +37,7 @@ void cmExportBuildAndroidMKGenerator::GenerateImportFooterCode(std::ostream&)
 }
 
 void cmExportBuildAndroidMKGenerator::GenerateExpectedTargetsCode(
-  std::ostream&, const std::string&)
+  std::ostream&, std::string const&)
 {
 }
 
@@ -57,8 +57,8 @@ void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode(
 }
 
 void cmExportBuildAndroidMKGenerator::GenerateImportPropertyCode(
-  std::ostream&, const std::string&, const std::string&,
-  cmGeneratorTarget const*, ImportPropertyMap const&, const std::string&)
+  std::ostream&, std::string const&, std::string const&,
+  cmGeneratorTarget const*, ImportPropertyMap const&, std::string const&)
 {
 }
 
@@ -68,8 +68,8 @@ void cmExportBuildAndroidMKGenerator::GenerateMissingTargetsCheckCode(
 }
 
 void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
-  const cmGeneratorTarget* target, std::ostream& os,
-  const ImportPropertyMap& properties)
+  cmGeneratorTarget const* target, std::ostream& os,
+  ImportPropertyMap const& properties)
 {
   std::string config;
   if (!this->Configurations.empty()) {
@@ -80,11 +80,11 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
 }
 
 void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
-  const cmGeneratorTarget* target, std::ostream& os,
-  const ImportPropertyMap& properties, GenerateType type,
+  cmGeneratorTarget const* target, std::ostream& os,
+  ImportPropertyMap const& properties, GenerateType type,
   std::string const& config)
 {
-  const bool newCMP0022Behavior =
+  bool const newCMP0022Behavior =
     target->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
     target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
   if (!newCMP0022Behavior) {

+ 6 - 6
Source/cmExportBuildAndroidMKGenerator.h

@@ -34,7 +34,7 @@ public:
   };
   static void GenerateInterfaceProperties(cmGeneratorTarget const* target,
                                           std::ostream& os,
-                                          const ImportPropertyMap& properties,
+                                          ImportPropertyMap const& properties,
                                           GenerateType type,
                                           std::string const& config);
 
@@ -43,20 +43,20 @@ protected:
   void GeneratePolicyHeaderCode(std::ostream&) override {}
   void GeneratePolicyFooterCode(std::ostream&) override {}
   void GenerateImportHeaderCode(std::ostream& os,
-                                const std::string& config = "") override;
+                                std::string const& config = "") override;
   void GenerateImportFooterCode(std::ostream& os) override;
   void GenerateImportTargetCode(
     std::ostream& os, cmGeneratorTarget const* target,
     cmStateEnums::TargetType /*targetType*/) override;
   void GenerateExpectedTargetsCode(
-    std::ostream& os, const std::string& expectedTargets) override;
+    std::ostream& os, std::string const& expectedTargets) override;
   void GenerateImportPropertyCode(
-    std::ostream& os, const std::string& config, const std::string& suffix,
+    std::ostream& os, std::string const& config, std::string const& suffix,
     cmGeneratorTarget const* target, ImportPropertyMap const& properties,
-    const std::string& importedXcFrameworkLocation) override;
+    std::string const& importedXcFrameworkLocation) override;
   void GenerateMissingTargetsCheckCode(std::ostream& os) override;
   void GenerateFindDependencyCalls(std::ostream&) override {}
   void GenerateInterfaceProperties(
     cmGeneratorTarget const* target, std::ostream& os,
-    const ImportPropertyMap& properties) override;
+    ImportPropertyMap const& properties) override;
 };

+ 11 - 11
Source/cmExportBuildCMakeConfigGenerator.cxx

@@ -144,7 +144,7 @@ bool cmExportBuildCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
       return false;
     }
 
-    const bool newCMP0022Behavior =
+    bool const newCMP0022Behavior =
       gte->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
       gte->GetPolicyStatusCMP0022() != cmPolicies::OLD;
     if (newCMP0022Behavior) {
@@ -190,7 +190,7 @@ bool cmExportBuildCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
 }
 
 void cmExportBuildCMakeConfigGenerator::GenerateImportTargetsConfig(
-  std::ostream& os, const std::string& config, std::string const& suffix)
+  std::ostream& os, std::string const& config, std::string const& suffix)
 {
   for (auto const& exp : this->Exports) {
     cmGeneratorTarget* target = exp.Target;
@@ -261,7 +261,7 @@ void cmExportBuildCMakeConfigGenerator::SetExportSet(cmExportSet* exportSet)
 }
 
 void cmExportBuildCMakeConfigGenerator::SetImportLocationProperty(
-  const std::string& config, std::string const& suffix,
+  std::string const& config, std::string const& suffix,
   cmGeneratorTarget* target, ImportPropertyMap& properties)
 {
   // Get the makefile in which to lookup target information.
@@ -277,7 +277,7 @@ void cmExportBuildCMakeConfigGenerator::SetImportLocationProperty(
     std::string const obj_dir = target->GetObjectDirectory(config);
     std::vector<std::string> objects;
     for (cmSourceFile const* sf : objectSources) {
-      const std::string& obj = target->GetObjectName(sf);
+      std::string const& obj = target->GetObjectName(sf);
       objects.push_back(obj_dir + obj);
     }
 
@@ -318,7 +318,7 @@ void cmExportBuildCMakeConfigGenerator::HandleMissingTarget(
 {
   // The target is not in the export.
   if (!this->AppendMode) {
-    const std::string name = dependee->GetName();
+    std::string const name = dependee->GetName();
     cmGlobalGenerator* gg =
       dependee->GetLocalGenerator()->GetGlobalGenerator();
     auto exportInfo = this->FindBuildExportInfo(gg, name);
@@ -360,7 +360,7 @@ void cmExportBuildCMakeConfigGenerator::GetTargets(
 
 std::pair<std::vector<std::string>, std::string>
 cmExportBuildCMakeConfigGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
-                                                       const std::string& name)
+                                                       std::string const& name)
 {
   std::vector<std::string> exportFiles;
   std::string ns;
@@ -368,12 +368,12 @@ cmExportBuildCMakeConfigGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
   auto& exportSets = gg->GetBuildExportSets();
 
   for (auto const& exp : exportSets) {
-    const auto& exportSet = exp.second;
+    auto const& exportSet = exp.second;
     std::vector<TargetExport> targets;
     exportSet->GetTargets(targets);
     if (std::any_of(
           targets.begin(), targets.end(),
-          [&name](const TargetExport& te) { return te.Name == name; })) {
+          [&name](TargetExport const& te) { return te.Name == name; })) {
       exportFiles.push_back(exp.first);
       ns = exportSet->GetNamespace();
     }
@@ -406,7 +406,7 @@ void cmExportBuildCMakeConfigGenerator::ComplainAboutMissingTarget(
 }
 
 std::string cmExportBuildCMakeConfigGenerator::InstallNameDir(
-  cmGeneratorTarget const* target, const std::string& config)
+  cmGeneratorTarget const* target, std::string const& config)
 {
   std::string install_name_dir;
 
@@ -420,7 +420,7 @@ std::string cmExportBuildCMakeConfigGenerator::InstallNameDir(
 
 namespace {
 bool EntryIsContextSensitive(
-  const std::unique_ptr<cmCompiledGeneratorExpression>& cge)
+  std::unique_ptr<cmCompiledGeneratorExpression> const& cge)
 {
   return cge->GetHadContextSensitiveCondition();
 }
@@ -544,7 +544,7 @@ std::string cmExportBuildCMakeConfigGenerator::GetCxxModulesDirectory() const
 void cmExportBuildCMakeConfigGenerator::GenerateCxxModuleConfigInformation(
   std::string const& name, std::ostream& os) const
 {
-  const char* opt = "";
+  char const* opt = "";
   if (this->Configurations.size() > 1) {
     // With more than one configuration, each individual file is optional.
     opt = " OPTIONAL";

+ 5 - 5
Source/cmExportBuildCMakeConfigGenerator.h

@@ -64,7 +64,7 @@ public:
   {
     this->CxxModulesDirectory = std::move(cxx_module_dir);
   }
-  const std::string& GetCxxModuleDirectory() const
+  std::string const& GetCxxModuleDirectory() const
   {
     return this->CxxModulesDirectory;
   }
@@ -77,7 +77,7 @@ public:
 protected:
   // Implement virtual methods from the superclass.
   bool GenerateMainFile(std::ostream& os) override;
-  void GenerateImportTargetsConfig(std::ostream& os, const std::string& config,
+  void GenerateImportTargetsConfig(std::ostream& os, std::string const& config,
                                    std::string const& suffix) override;
   cmStateEnums::TargetType GetExportTargetType(
     cmGeneratorTarget const* target) const;
@@ -90,13 +90,13 @@ protected:
                                   std::vector<std::string> const& namespaces);
 
   /** Fill in properties indicating built file locations.  */
-  void SetImportLocationProperty(const std::string& config,
+  void SetImportLocationProperty(std::string const& config,
                                  std::string const& suffix,
                                  cmGeneratorTarget* target,
                                  ImportPropertyMap& properties);
 
   std::string InstallNameDir(cmGeneratorTarget const* target,
-                             const std::string& config) override;
+                             std::string const& config) override;
 
   std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
                                     cmTargetExport* te) override;
@@ -111,7 +111,7 @@ protected:
                                                     std::string) const;
 
   std::pair<std::vector<std::string>, std::string> FindBuildExportInfo(
-    cmGlobalGenerator* gg, const std::string& name);
+    cmGlobalGenerator* gg, std::string const& name);
 
   struct TargetExportPrivate
   {

+ 11 - 11
Source/cmExportBuildFileGenerator.cxx

@@ -144,7 +144,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
       return false;
     }
 
-    const bool newCMP0022Behavior =
+    bool const newCMP0022Behavior =
       gte->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
       gte->GetPolicyStatusCMP0022() != cmPolicies::OLD;
     if (newCMP0022Behavior) {
@@ -190,7 +190,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
 }
 
 void cmExportBuildFileGenerator::GenerateImportTargetsConfig(
-  std::ostream& os, const std::string& config, std::string const& suffix)
+  std::ostream& os, std::string const& config, std::string const& suffix)
 {
   for (auto const& exp : this->Exports) {
     cmGeneratorTarget* target = exp.Target;
@@ -260,7 +260,7 @@ void cmExportBuildFileGenerator::SetExportSet(cmExportSet* exportSet)
 }
 
 void cmExportBuildFileGenerator::SetImportLocationProperty(
-  const std::string& config, std::string const& suffix,
+  std::string const& config, std::string const& suffix,
   cmGeneratorTarget* target, ImportPropertyMap& properties)
 {
   // Get the makefile in which to lookup target information.
@@ -276,7 +276,7 @@ void cmExportBuildFileGenerator::SetImportLocationProperty(
     std::string const obj_dir = target->GetObjectDirectory(config);
     std::vector<std::string> objects;
     for (cmSourceFile const* sf : objectSources) {
-      const std::string& obj = target->GetObjectName(sf);
+      std::string const& obj = target->GetObjectName(sf);
       objects.push_back(obj_dir + obj);
     }
 
@@ -317,7 +317,7 @@ void cmExportBuildFileGenerator::HandleMissingTarget(
 {
   // The target is not in the export.
   if (!this->AppendMode) {
-    const std::string name = dependee->GetName();
+    std::string const name = dependee->GetName();
     cmGlobalGenerator* gg =
       dependee->GetLocalGenerator()->GetGlobalGenerator();
     auto exportInfo = this->FindBuildExportInfo(gg, name);
@@ -359,7 +359,7 @@ void cmExportBuildFileGenerator::GetTargets(
 
 std::pair<std::vector<std::string>, std::string>
 cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
-                                                const std::string& name)
+                                                std::string const& name)
 {
   std::vector<std::string> exportFiles;
   std::string ns;
@@ -367,12 +367,12 @@ cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
   auto& exportSets = gg->GetBuildExportSets();
 
   for (auto const& exp : exportSets) {
-    const auto& exportSet = exp.second;
+    auto const& exportSet = exp.second;
     std::vector<TargetExport> targets;
     exportSet->GetTargets(targets);
     if (std::any_of(
           targets.begin(), targets.end(),
-          [&name](const TargetExport& te) { return te.Name == name; })) {
+          [&name](TargetExport const& te) { return te.Name == name; })) {
       exportFiles.push_back(exp.first);
       ns = exportSet->GetNamespace();
     }
@@ -405,7 +405,7 @@ void cmExportBuildFileGenerator::ComplainAboutMissingTarget(
 }
 
 std::string cmExportBuildFileGenerator::InstallNameDir(
-  cmGeneratorTarget const* target, const std::string& config)
+  cmGeneratorTarget const* target, std::string const& config)
 {
   std::string install_name_dir;
 
@@ -419,7 +419,7 @@ std::string cmExportBuildFileGenerator::InstallNameDir(
 
 namespace {
 bool EntryIsContextSensitive(
-  const std::unique_ptr<cmCompiledGeneratorExpression>& cge)
+  std::unique_ptr<cmCompiledGeneratorExpression> const& cge)
 {
   return cge->GetHadContextSensitiveCondition();
 }
@@ -544,7 +544,7 @@ std::string cmExportBuildFileGenerator::GetCxxModulesDirectory() const
 void cmExportBuildFileGenerator::GenerateCxxModuleConfigInformation(
   std::string const& name, std::ostream& os) const
 {
-  const char* opt = "";
+  char const* opt = "";
   if (this->Configurations.size() > 1) {
     // With more than one configuration, each individual file is optional.
     opt = " OPTIONAL";

+ 5 - 5
Source/cmExportBuildFileGenerator.h

@@ -64,7 +64,7 @@ public:
   {
     this->CxxModulesDirectory = std::move(cxx_module_dir);
   }
-  const std::string& GetCxxModuleDirectory() const
+  std::string const& GetCxxModuleDirectory() const
   {
     return this->CxxModulesDirectory;
   }
@@ -77,7 +77,7 @@ public:
 protected:
   // Implement virtual methods from the superclass.
   bool GenerateMainFile(std::ostream& os) override;
-  void GenerateImportTargetsConfig(std::ostream& os, const std::string& config,
+  void GenerateImportTargetsConfig(std::ostream& os, std::string const& config,
                                    std::string const& suffix) override;
   cmStateEnums::TargetType GetExportTargetType(
     cmGeneratorTarget const* target) const;
@@ -90,13 +90,13 @@ protected:
                                   std::vector<std::string> const& namespaces);
 
   /** Fill in properties indicating built file locations.  */
-  void SetImportLocationProperty(const std::string& config,
+  void SetImportLocationProperty(std::string const& config,
                                  std::string const& suffix,
                                  cmGeneratorTarget* target,
                                  ImportPropertyMap& properties);
 
   std::string InstallNameDir(cmGeneratorTarget const* target,
-                             const std::string& config) override;
+                             std::string const& config) override;
 
   std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
                                     cmTargetExport* te) override;
@@ -111,7 +111,7 @@ protected:
                                                     std::string) const;
 
   std::pair<std::vector<std::string>, std::string> FindBuildExportInfo(
-    cmGlobalGenerator* gg, const std::string& name);
+    cmGlobalGenerator* gg, std::string const& name);
 
   struct TargetExportPrivate
   {

+ 39 - 39
Source/cmExportCMakeConfigGenerator.cxx

@@ -55,12 +55,12 @@ cmExportCMakeConfigGenerator::cmExportCMakeConfigGenerator()
   this->ExportOld = false;
 }
 
-void cmExportCMakeConfigGenerator::AddConfiguration(const std::string& config)
+void cmExportCMakeConfigGenerator::AddConfiguration(std::string const& config)
 {
   this->Configurations.push_back(config);
 }
 
-void cmExportCMakeConfigGenerator::SetExportFile(const char* mainFile)
+void cmExportCMakeConfigGenerator::SetExportFile(char const* mainFile)
 {
   this->MainImportFile = mainFile;
   this->FileDir = cmSystemTools::GetFilenamePath(this->MainImportFile);
@@ -70,7 +70,7 @@ void cmExportCMakeConfigGenerator::SetExportFile(const char* mainFile)
     cmSystemTools::GetFilenameLastExtension(this->MainImportFile);
 }
 
-const std::string& cmExportCMakeConfigGenerator::GetMainExportFileName() const
+std::string const& cmExportCMakeConfigGenerator::GetMainExportFileName() const
 {
   return this->MainImportFile;
 }
@@ -133,7 +133,7 @@ bool cmExportCMakeConfigGenerator::GenerateImportFile()
 }
 
 void cmExportCMakeConfigGenerator::GenerateImportConfig(
-  std::ostream& os, const std::string& config)
+  std::ostream& os, std::string const& config)
 {
   // Construct the property configuration suffix.
   std::string suffix = "_";
@@ -148,7 +148,7 @@ void cmExportCMakeConfigGenerator::GenerateImportConfig(
 }
 
 void cmExportCMakeConfigGenerator::PopulateInterfaceProperty(
-  const std::string& propName, cmGeneratorTarget const* target,
+  std::string const& propName, cmGeneratorTarget const* target,
   ImportPropertyMap& properties)
 {
   cmValue input = target->GetProperty(propName);
@@ -158,7 +158,7 @@ void cmExportCMakeConfigGenerator::PopulateInterfaceProperty(
 }
 
 void cmExportCMakeConfigGenerator::PopulateInterfaceProperty(
-  const std::string& propName, const std::string& outputName,
+  std::string const& propName, std::string const& outputName,
   cmGeneratorTarget const* target,
   cmGeneratorExpression::PreprocessContext preprocessRule,
   ImportPropertyMap& properties)
@@ -188,7 +188,7 @@ bool cmExportCMakeConfigGenerator::PopulateInterfaceLinkLibrariesProperty(
   if (!target->IsLinkable()) {
     return false;
   }
-  static const std::array<std::string, 3> linkIfaceProps = {
+  static std::array<std::string, 3> const linkIfaceProps = {
     { "INTERFACE_LINK_LIBRARIES", "INTERFACE_LINK_LIBRARIES_DIRECT",
       "INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE" }
   };
@@ -214,9 +214,9 @@ static bool isSubDirectory(std::string const& a, std::string const& b)
           cmSystemTools::IsSubDirectory(a, b));
 }
 
-static bool checkInterfaceDirs(const std::string& prepro,
+static bool checkInterfaceDirs(std::string const& prepro,
                                cmGeneratorTarget const* target,
-                               const std::string& prop)
+                               std::string const& prop)
 {
   std::string const& installDir =
     target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
@@ -228,7 +228,7 @@ static bool checkInterfaceDirs(const std::string& prepro,
   std::vector<std::string> parts;
   cmGeneratorExpression::Split(prepro, parts);
 
-  const bool inSourceBuild = topSourceDir == topBinaryDir;
+  bool const inSourceBuild = topSourceDir == topBinaryDir;
 
   bool hadFatalError = false;
 
@@ -341,7 +341,7 @@ static void prefixItems(std::string& exportDirs)
   std::vector<std::string> entries;
   cmGeneratorExpression::Split(exportDirs, entries);
   exportDirs.clear();
-  const char* sep = "";
+  char const* sep = "";
   for (std::string const& e : entries) {
     exportDirs += sep;
     sep = ";";
@@ -360,7 +360,7 @@ void cmExportCMakeConfigGenerator::PopulateSourcesInterface(
 {
   assert(preprocessRule == cmGeneratorExpression::InstallInterface);
 
-  const char* propName = "INTERFACE_SOURCES";
+  char const* propName = "INTERFACE_SOURCES";
   cmValue input = gt->GetProperty(propName);
 
   if (!input) {
@@ -394,7 +394,7 @@ void cmExportCMakeConfigGenerator::PopulateIncludeDirectoriesInterface(
 
   includesDestinationDirs.clear();
 
-  const char* propName = "INTERFACE_INCLUDE_DIRECTORIES";
+  char const* propName = "INTERFACE_INCLUDE_DIRECTORIES";
   cmValue input = target->GetProperty(propName);
 
   cmGeneratorExpression ge(*target->Makefile->GetCMakeInstance());
@@ -433,7 +433,7 @@ void cmExportCMakeConfigGenerator::PopulateIncludeDirectoriesInterface(
   includesDestinationDirs = exportDirs;
 
   std::string includes = (input ? *input : "");
-  const char* sep = input ? ";" : "";
+  char const* sep = input ? ";" : "";
   includes += sep + exportDirs;
   std::string prepro =
     cmGeneratorExpression::Preprocess(includes, preprocessRule, true);
@@ -454,7 +454,7 @@ void cmExportCMakeConfigGenerator::PopulateLinkDependsInterface(
 {
   assert(preprocessRule == cmGeneratorExpression::InstallInterface);
 
-  const char* propName = "INTERFACE_LINK_DEPENDS";
+  char const* propName = "INTERFACE_LINK_DEPENDS";
   cmValue input = gt->GetProperty(propName);
 
   if (!input) {
@@ -485,7 +485,7 @@ void cmExportCMakeConfigGenerator::PopulateLinkDirectoriesInterface(
 {
   assert(preprocessRule == cmGeneratorExpression::InstallInterface);
 
-  const char* propName = "INTERFACE_LINK_DIRECTORIES";
+  char const* propName = "INTERFACE_LINK_DIRECTORIES";
   cmValue input = gt->GetProperty(propName);
 
   if (!input) {
@@ -510,7 +510,7 @@ void cmExportCMakeConfigGenerator::PopulateLinkDirectoriesInterface(
 }
 
 void cmExportCMakeConfigGenerator::PopulateInterfaceProperty(
-  const std::string& propName, cmGeneratorTarget const* target,
+  std::string const& propName, cmGeneratorTarget const* target,
   cmGeneratorExpression::PreprocessContext preprocessRule,
   ImportPropertyMap& properties)
 {
@@ -519,7 +519,7 @@ void cmExportCMakeConfigGenerator::PopulateInterfaceProperty(
 }
 
 static void getPropertyContents(cmGeneratorTarget const* tgt,
-                                const std::string& prop,
+                                std::string const& prop,
                                 std::set<std::string>& ifaceProperties)
 {
   cmValue p = tgt->GetProperty(prop);
@@ -532,7 +532,7 @@ static void getPropertyContents(cmGeneratorTarget const* tgt,
 
 static void getCompatibleInterfaceProperties(
   cmGeneratorTarget const* target, std::set<std::string>& ifaceProperties,
-  const std::string& config)
+  std::string const& config)
 {
   if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
     // object libraries have no link information, so nothing to compute
@@ -551,7 +551,7 @@ static void getCompatibleInterfaceProperties(
     return;
   }
 
-  const cmComputeLinkInformation::ItemVector& deps = info->GetItems();
+  cmComputeLinkInformation::ItemVector const& deps = info->GetItems();
 
   for (auto const& dep : deps) {
     if (!dep.Target || dep.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
@@ -626,8 +626,8 @@ void cmExportCMakeConfigGenerator::PopulateCustomTransitiveInterfaceProperties(
 }
 
 void cmExportCMakeConfigGenerator::GenerateInterfaceProperties(
-  const cmGeneratorTarget* target, std::ostream& os,
-  const ImportPropertyMap& properties)
+  cmGeneratorTarget const* target, std::ostream& os,
+  ImportPropertyMap const& properties)
 {
   if (!properties.empty()) {
     std::string targetName =
@@ -811,7 +811,7 @@ void cmExportCMakeConfigGenerator::ReplaceInstallPrefix(
 }
 
 void cmExportCMakeConfigGenerator::SetImportLinkInterface(
-  const std::string& config, std::string const& suffix,
+  std::string const& config, std::string const& suffix,
   cmGeneratorExpression::PreprocessContext preprocessRule,
   cmGeneratorTarget const* target, ImportPropertyMap& properties)
 {
@@ -840,7 +840,7 @@ void cmExportCMakeConfigGenerator::SetImportLinkInterface(
     return;
   }
 
-  const bool newCMP0022Behavior =
+  bool const newCMP0022Behavior =
     target->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
     target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
 
@@ -871,7 +871,7 @@ void cmExportCMakeConfigGenerator::SetImportLinkInterface(
 }
 
 void cmExportCMakeConfigGenerator::SetImportDetailProperties(
-  const std::string& config, std::string const& suffix,
+  std::string const& config, std::string const& suffix,
   cmGeneratorTarget* target, ImportPropertyMap& properties)
 {
   // Get the makefile in which to lookup target information.
@@ -956,7 +956,7 @@ static std::string const& asString(cmLinkItem const& l)
 template <typename T>
 void cmExportCMakeConfigGenerator::SetImportLinkProperty(
   std::string const& suffix, cmGeneratorTarget const* target,
-  const std::string& propName, std::vector<T> const& entries,
+  std::string const& propName, std::vector<T> const& entries,
   ImportPropertyMap& properties, ImportLinkPropertyTargetNames targetNames)
 {
   // Skip the property if there are no entries.
@@ -968,7 +968,7 @@ void cmExportCMakeConfigGenerator::SetImportLinkProperty(
 
   // Construct the property value.
   std::string link_entries;
-  const char* sep = "";
+  char const* sep = "";
   for (T const& l : entries) {
     // Separate this from the previous entry.
     link_entries += sep;
@@ -1029,7 +1029,7 @@ void cmExportCMakeConfigGenerator::GeneratePolicyFooterCode(std::ostream& os)
 }
 
 void cmExportCMakeConfigGenerator::GenerateImportHeaderCode(
-  std::ostream& os, const std::string& config)
+  std::ostream& os, std::string const& config)
 {
   os << "#----------------------------------------------------------------\n"
      << "# Generated CMake target import file";
@@ -1061,7 +1061,7 @@ void cmExportCMakeConfigGenerator::GenerateImportVersionCode(std::ostream& os)
 }
 
 void cmExportCMakeConfigGenerator::GenerateExpectedTargetsCode(
-  std::ostream& os, const std::string& expectedTargets)
+  std::ostream& os, std::string const& expectedTargets)
 {
   /* clang-format off */
   os << "# Protect against multiple inclusion, which would fail when already "
@@ -1179,9 +1179,9 @@ void cmExportCMakeConfigGenerator::GenerateImportTargetCode(
 }
 
 void cmExportCMakeConfigGenerator::GenerateImportPropertyCode(
-  std::ostream& os, const std::string& config, const std::string& suffix,
+  std::ostream& os, std::string const& config, std::string const& suffix,
   cmGeneratorTarget const* target, ImportPropertyMap const& properties,
-  const std::string& importedXcFrameworkLocation)
+  std::string const& importedXcFrameworkLocation)
 {
   // Construct the imported target name.
   std::string targetName = this->Namespace;
@@ -1265,8 +1265,8 @@ void cmExportCMakeConfigGenerator::GenerateFindDependencyCalls(
                               packageDependencies.end());
   std::sort(
     packageDependenciesSorted.begin(), packageDependenciesSorted.end(),
-    [](const std::pair<std::string, cmExportSet::PackageDependency>& lhs,
-       const std::pair<std::string, cmExportSet::PackageDependency>& rhs)
+    [](std::pair<std::string, cmExportSet::PackageDependency> const& lhs,
+       std::pair<std::string, cmExportSet::PackageDependency> const& rhs)
       -> bool {
       if (lhs.second.SpecifiedIndex) {
         if (rhs.second.SpecifiedIndex) {
@@ -1391,8 +1391,8 @@ void cmExportCMakeConfigGenerator::GenerateImportedFileCheckLoop(
 void cmExportCMakeConfigGenerator::GenerateImportedFileChecksCode(
   std::ostream& os, cmGeneratorTarget* target,
   ImportPropertyMap const& properties,
-  const std::set<std::string>& importedLocations,
-  const std::string& importedXcFrameworkLocation)
+  std::set<std::string> const& importedLocations,
+  std::string const& importedXcFrameworkLocation)
 {
   // Construct the imported target name.
   std::string targetName = cmStrCat(this->Namespace, target->GetExportName());
@@ -1463,7 +1463,7 @@ bool cmExportCMakeConfigGenerator::PopulateCxxModuleExportProperties(
     return true;
   }
 
-  const ModuleTargetPropertyTable exportedDirectModuleProperties[] = {
+  ModuleTargetPropertyTable const exportedDirectModuleProperties[] = {
     { "CXX_EXTENSIONS"_s, ExportWhen::Defined },
     // Always define this property as it is an intrinsic property of the target
     // and should not be inherited from the in-scope `CMAKE_CXX_MODULE_STD`
@@ -1489,7 +1489,7 @@ bool cmExportCMakeConfigGenerator::PopulateCxxModuleExportProperties(
     }
   }
 
-  const ModulePropertyTable exportedModuleProperties[] = {
+  ModulePropertyTable const exportedModuleProperties[] = {
     { "INCLUDE_DIRECTORIES"_s, PropertyType::IncludePaths },
     { "COMPILE_DEFINITIONS"_s, PropertyType::Strings },
     { "COMPILE_OPTIONS"_s, PropertyType::Strings },
@@ -1522,7 +1522,7 @@ bool cmExportCMakeConfigGenerator::PopulateCxxModuleExportProperties(
     }
   }
 
-  const cm::static_string_view exportedLinkModuleProperties[] = {
+  cm::static_string_view const exportedLinkModuleProperties[] = {
     "LINK_LIBRARIES"_s,
   };
   for (auto const& propName : exportedLinkModuleProperties) {
@@ -1549,7 +1549,7 @@ bool cmExportCMakeConfigGenerator::PopulateExportProperties(
   cmGeneratorTarget const* gte, ImportPropertyMap& properties,
   std::string& errorMessage)
 {
-  const auto& targetProperties = gte->Target->GetProperties();
+  auto const& targetProperties = gte->Target->GetProperties();
   if (cmValue exportProperties =
         targetProperties.GetPropertyValue("EXPORT_PROPERTIES")) {
     for (auto& prop : cmList{ *exportProperties }) {

+ 20 - 20
Source/cmExportCMakeConfigGenerator.h

@@ -46,17 +46,17 @@ public:
   virtual ~cmExportCMakeConfigGenerator() = default;
 
   /** Set the full path to the export file to generate.  */
-  void SetExportFile(const char* mainFile);
-  const std::string& GetMainExportFileName() const;
+  void SetExportFile(char const* mainFile);
+  std::string const& GetMainExportFileName() const;
 
   /** Set the namespace in which to place exported target names.  */
-  void SetNamespace(const std::string& ns) { this->Namespace = ns; }
+  void SetNamespace(std::string const& ns) { this->Namespace = ns; }
   std::string GetNamespace() const { return this->Namespace; }
 
   void SetExportOld(bool exportOld) { this->ExportOld = exportOld; }
 
   /** Add a configuration to be exported.  */
-  void AddConfiguration(const std::string& config);
+  void AddConfiguration(std::string const& config);
 
   /** Actually generate the export file.  Returns whether there was an
       error.  */
@@ -72,37 +72,37 @@ protected:
 
   // Generate per-configuration target information to the given output
   // stream.
-  void GenerateImportConfig(std::ostream& os, const std::string& config);
+  void GenerateImportConfig(std::ostream& os, std::string const& config);
 
   // Methods to implement export file code generation.
   virtual void GeneratePolicyHeaderCode(std::ostream& os);
   virtual void GeneratePolicyFooterCode(std::ostream& os);
   virtual void GenerateImportHeaderCode(std::ostream& os,
-                                        const std::string& config = "");
+                                        std::string const& config = "");
   virtual void GenerateImportFooterCode(std::ostream& os);
   void GenerateImportVersionCode(std::ostream& os);
   virtual void GenerateImportTargetCode(std::ostream& os,
                                         cmGeneratorTarget const* target,
                                         cmStateEnums::TargetType targetType);
   virtual void GenerateImportPropertyCode(
-    std::ostream& os, const std::string& config, const std::string& suffix,
+    std::ostream& os, std::string const& config, std::string const& suffix,
     cmGeneratorTarget const* target, ImportPropertyMap const& properties,
-    const std::string& importedXcFrameworkLocation);
+    std::string const& importedXcFrameworkLocation);
   virtual void GenerateImportedFileChecksCode(
     std::ostream& os, cmGeneratorTarget* target,
     ImportPropertyMap const& properties,
-    const std::set<std::string>& importedLocations,
-    const std::string& importedXcFrameworkLocation);
+    std::set<std::string> const& importedLocations,
+    std::string const& importedXcFrameworkLocation);
   virtual void GenerateImportedFileCheckLoop(std::ostream& os);
   virtual void GenerateMissingTargetsCheckCode(std::ostream& os);
   virtual void GenerateFindDependencyCalls(std::ostream& os);
 
   virtual void GenerateExpectedTargetsCode(std::ostream& os,
-                                           const std::string& expectedTargets);
+                                           std::string const& expectedTargets);
 
   // Collect properties with detailed information about targets beyond
   // their location on disk.
-  void SetImportDetailProperties(const std::string& config,
+  void SetImportDetailProperties(std::string const& config,
                                  std::string const& suffix,
                                  cmGeneratorTarget* target,
                                  ImportPropertyMap& properties);
@@ -115,7 +115,7 @@ protected:
   template <typename T>
   void SetImportLinkProperty(std::string const& suffix,
                              cmGeneratorTarget const* target,
-                             const std::string& propName,
+                             std::string const& propName,
                              std::vector<T> const& entries,
                              ImportPropertyMap& properties,
                              ImportLinkPropertyTargetNames targetNames);
@@ -125,7 +125,7 @@ protected:
 
   /** Each subclass knows where the target files are located.  */
   virtual void GenerateImportTargetsConfig(std::ostream& os,
-                                           const std::string& config,
+                                           std::string const& config,
                                            std::string const& suffix) = 0;
 
   /** Each subclass knows how to deal with a target that is  missing from an
@@ -133,14 +133,14 @@ protected:
   virtual void HandleMissingTarget(std::string& link_libs,
                                    cmGeneratorTarget const* depender,
                                    cmGeneratorTarget* dependee) = 0;
-  void PopulateInterfaceProperty(const std::string&,
+  void PopulateInterfaceProperty(std::string const&,
                                  cmGeneratorTarget const* target,
                                  cmGeneratorExpression::PreprocessContext,
                                  ImportPropertyMap& properties);
   bool PopulateInterfaceLinkLibrariesProperty(
     cmGeneratorTarget const* target, cmGeneratorExpression::PreprocessContext,
     ImportPropertyMap& properties);
-  void PopulateInterfaceProperty(const std::string& propName,
+  void PopulateInterfaceProperty(std::string const& propName,
                                  cmGeneratorTarget const* target,
                                  ImportPropertyMap& properties);
   void PopulateCompatibleInterfaceProperties(cmGeneratorTarget const* target,
@@ -151,7 +151,7 @@ protected:
     ImportPropertyMap& properties);
   virtual void GenerateInterfaceProperties(
     cmGeneratorTarget const* target, std::ostream& os,
-    const ImportPropertyMap& properties);
+    ImportPropertyMap const& properties);
   void PopulateIncludeDirectoriesInterface(
     cmGeneratorTarget const* target,
     cmGeneratorExpression::PreprocessContext preprocessRule,
@@ -171,7 +171,7 @@ protected:
     ImportPropertyMap& properties);
 
   void SetImportLinkInterface(
-    const std::string& config, std::string const& suffix,
+    std::string const& config, std::string const& suffix,
     cmGeneratorExpression::PreprocessContext preprocessRule,
     cmGeneratorTarget const* target, ImportPropertyMap& properties);
 
@@ -241,7 +241,7 @@ protected:
   bool ExportPackageDependencies = false;
 
 private:
-  void PopulateInterfaceProperty(const std::string&, const std::string&,
+  void PopulateInterfaceProperty(std::string const&, std::string const&,
                                  cmGeneratorTarget const* target,
                                  cmGeneratorExpression::PreprocessContext,
                                  ImportPropertyMap& properties);
@@ -256,7 +256,7 @@ private:
   virtual void ReplaceInstallPrefix(std::string& input);
 
   virtual std::string InstallNameDir(cmGeneratorTarget const* target,
-                                     const std::string& config) = 0;
+                                     std::string const& config) = 0;
 
   virtual std::string GetCxxModulesDirectory() const = 0;
   virtual void GenerateCxxModuleConfigInformation(std::string const&,

+ 39 - 39
Source/cmExportFileGenerator.cxx

@@ -55,12 +55,12 @@ cmExportFileGenerator::cmExportFileGenerator()
   this->ExportOld = false;
 }
 
-void cmExportFileGenerator::AddConfiguration(const std::string& config)
+void cmExportFileGenerator::AddConfiguration(std::string const& config)
 {
   this->Configurations.push_back(config);
 }
 
-void cmExportFileGenerator::SetExportFile(const char* mainFile)
+void cmExportFileGenerator::SetExportFile(char const* mainFile)
 {
   this->MainImportFile = mainFile;
   this->FileDir = cmSystemTools::GetFilenamePath(this->MainImportFile);
@@ -70,7 +70,7 @@ void cmExportFileGenerator::SetExportFile(const char* mainFile)
     cmSystemTools::GetFilenameLastExtension(this->MainImportFile);
 }
 
-const std::string& cmExportFileGenerator::GetMainExportFileName() const
+std::string const& cmExportFileGenerator::GetMainExportFileName() const
 {
   return this->MainImportFile;
 }
@@ -133,7 +133,7 @@ bool cmExportFileGenerator::GenerateImportFile()
 }
 
 void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
-                                                 const std::string& config)
+                                                 std::string const& config)
 {
   // Construct the property configuration suffix.
   std::string suffix = "_";
@@ -148,7 +148,7 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
 }
 
 void cmExportFileGenerator::PopulateInterfaceProperty(
-  const std::string& propName, cmGeneratorTarget const* target,
+  std::string const& propName, cmGeneratorTarget const* target,
   ImportPropertyMap& properties)
 {
   cmValue input = target->GetProperty(propName);
@@ -158,7 +158,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
 }
 
 void cmExportFileGenerator::PopulateInterfaceProperty(
-  const std::string& propName, const std::string& outputName,
+  std::string const& propName, std::string const& outputName,
   cmGeneratorTarget const* target,
   cmGeneratorExpression::PreprocessContext preprocessRule,
   ImportPropertyMap& properties)
@@ -188,7 +188,7 @@ bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
   if (!target->IsLinkable()) {
     return false;
   }
-  static const std::array<std::string, 3> linkIfaceProps = {
+  static std::array<std::string, 3> const linkIfaceProps = {
     { "INTERFACE_LINK_LIBRARIES", "INTERFACE_LINK_LIBRARIES_DIRECT",
       "INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE" }
   };
@@ -214,9 +214,9 @@ static bool isSubDirectory(std::string const& a, std::string const& b)
           cmSystemTools::IsSubDirectory(a, b));
 }
 
-static bool checkInterfaceDirs(const std::string& prepro,
+static bool checkInterfaceDirs(std::string const& prepro,
                                cmGeneratorTarget const* target,
-                               const std::string& prop)
+                               std::string const& prop)
 {
   std::string const& installDir =
     target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
@@ -228,7 +228,7 @@ static bool checkInterfaceDirs(const std::string& prepro,
   std::vector<std::string> parts;
   cmGeneratorExpression::Split(prepro, parts);
 
-  const bool inSourceBuild = topSourceDir == topBinaryDir;
+  bool const inSourceBuild = topSourceDir == topBinaryDir;
 
   bool hadFatalError = false;
 
@@ -341,7 +341,7 @@ static void prefixItems(std::string& exportDirs)
   std::vector<std::string> entries;
   cmGeneratorExpression::Split(exportDirs, entries);
   exportDirs.clear();
-  const char* sep = "";
+  char const* sep = "";
   for (std::string const& e : entries) {
     exportDirs += sep;
     sep = ";";
@@ -360,7 +360,7 @@ void cmExportFileGenerator::PopulateSourcesInterface(
 {
   assert(preprocessRule == cmGeneratorExpression::InstallInterface);
 
-  const char* propName = "INTERFACE_SOURCES";
+  char const* propName = "INTERFACE_SOURCES";
   cmValue input = gt->GetProperty(propName);
 
   if (!input) {
@@ -394,7 +394,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
 
   includesDestinationDirs.clear();
 
-  const char* propName = "INTERFACE_INCLUDE_DIRECTORIES";
+  char const* propName = "INTERFACE_INCLUDE_DIRECTORIES";
   cmValue input = target->GetProperty(propName);
 
   cmGeneratorExpression ge(*target->Makefile->GetCMakeInstance());
@@ -433,7 +433,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
   includesDestinationDirs = exportDirs;
 
   std::string includes = (input ? *input : "");
-  const char* sep = input ? ";" : "";
+  char const* sep = input ? ";" : "";
   includes += sep + exportDirs;
   std::string prepro =
     cmGeneratorExpression::Preprocess(includes, preprocessRule, true);
@@ -454,7 +454,7 @@ void cmExportFileGenerator::PopulateLinkDependsInterface(
 {
   assert(preprocessRule == cmGeneratorExpression::InstallInterface);
 
-  const char* propName = "INTERFACE_LINK_DEPENDS";
+  char const* propName = "INTERFACE_LINK_DEPENDS";
   cmValue input = gt->GetProperty(propName);
 
   if (!input) {
@@ -485,7 +485,7 @@ void cmExportFileGenerator::PopulateLinkDirectoriesInterface(
 {
   assert(preprocessRule == cmGeneratorExpression::InstallInterface);
 
-  const char* propName = "INTERFACE_LINK_DIRECTORIES";
+  char const* propName = "INTERFACE_LINK_DIRECTORIES";
   cmValue input = gt->GetProperty(propName);
 
   if (!input) {
@@ -510,7 +510,7 @@ void cmExportFileGenerator::PopulateLinkDirectoriesInterface(
 }
 
 void cmExportFileGenerator::PopulateInterfaceProperty(
-  const std::string& propName, cmGeneratorTarget const* target,
+  std::string const& propName, cmGeneratorTarget const* target,
   cmGeneratorExpression::PreprocessContext preprocessRule,
   ImportPropertyMap& properties)
 {
@@ -519,7 +519,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
 }
 
 static void getPropertyContents(cmGeneratorTarget const* tgt,
-                                const std::string& prop,
+                                std::string const& prop,
                                 std::set<std::string>& ifaceProperties)
 {
   cmValue p = tgt->GetProperty(prop);
@@ -532,7 +532,7 @@ static void getPropertyContents(cmGeneratorTarget const* tgt,
 
 static void getCompatibleInterfaceProperties(
   cmGeneratorTarget const* target, std::set<std::string>& ifaceProperties,
-  const std::string& config)
+  std::string const& config)
 {
   if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
     // object libraries have no link information, so nothing to compute
@@ -551,7 +551,7 @@ static void getCompatibleInterfaceProperties(
     return;
   }
 
-  const cmComputeLinkInformation::ItemVector& deps = info->GetItems();
+  cmComputeLinkInformation::ItemVector const& deps = info->GetItems();
 
   for (auto const& dep : deps) {
     if (!dep.Target || dep.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
@@ -627,8 +627,8 @@ void cmExportFileGenerator::PopulateCustomTransitiveInterfaceProperties(
 }
 
 void cmExportFileGenerator::GenerateInterfaceProperties(
-  const cmGeneratorTarget* target, std::ostream& os,
-  const ImportPropertyMap& properties)
+  cmGeneratorTarget const* target, std::ostream& os,
+  ImportPropertyMap const& properties)
 {
   if (!properties.empty()) {
     std::string targetName =
@@ -811,7 +811,7 @@ void cmExportFileGenerator::ReplaceInstallPrefix(std::string& /*unused*/)
 }
 
 void cmExportFileGenerator::SetImportLinkInterface(
-  const std::string& config, std::string const& suffix,
+  std::string const& config, std::string const& suffix,
   cmGeneratorExpression::PreprocessContext preprocessRule,
   cmGeneratorTarget const* target, ImportPropertyMap& properties)
 {
@@ -840,7 +840,7 @@ void cmExportFileGenerator::SetImportLinkInterface(
     return;
   }
 
-  const bool newCMP0022Behavior =
+  bool const newCMP0022Behavior =
     target->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
     target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
 
@@ -871,7 +871,7 @@ void cmExportFileGenerator::SetImportLinkInterface(
 }
 
 void cmExportFileGenerator::SetImportDetailProperties(
-  const std::string& config, std::string const& suffix,
+  std::string const& config, std::string const& suffix,
   cmGeneratorTarget* target, ImportPropertyMap& properties)
 {
   // Get the makefile in which to lookup target information.
@@ -956,7 +956,7 @@ static std::string const& asString(cmLinkItem const& l)
 template <typename T>
 void cmExportFileGenerator::SetImportLinkProperty(
   std::string const& suffix, cmGeneratorTarget const* target,
-  const std::string& propName, std::vector<T> const& entries,
+  std::string const& propName, std::vector<T> const& entries,
   ImportPropertyMap& properties, ImportLinkPropertyTargetNames targetNames)
 {
   // Skip the property if there are no entries.
@@ -968,7 +968,7 @@ void cmExportFileGenerator::SetImportLinkProperty(
 
   // Construct the property value.
   std::string link_entries;
-  const char* sep = "";
+  char const* sep = "";
   for (T const& l : entries) {
     // Separate this from the previous entry.
     link_entries += sep;
@@ -1032,7 +1032,7 @@ void cmExportFileGenerator::GeneratePolicyFooterCode(std::ostream& os)
 }
 
 void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os,
-                                                     const std::string& config)
+                                                     std::string const& config)
 {
   os << "#----------------------------------------------------------------\n"
      << "# Generated CMake target import file";
@@ -1064,7 +1064,7 @@ void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os)
 }
 
 void cmExportFileGenerator::GenerateExpectedTargetsCode(
-  std::ostream& os, const std::string& expectedTargets)
+  std::ostream& os, std::string const& expectedTargets)
 {
   /* clang-format off */
   os << "# Protect against multiple inclusion, which would fail when already "
@@ -1181,9 +1181,9 @@ void cmExportFileGenerator::GenerateImportTargetCode(
 }
 
 void cmExportFileGenerator::GenerateImportPropertyCode(
-  std::ostream& os, const std::string& config, const std::string& suffix,
+  std::ostream& os, std::string const& config, std::string const& suffix,
   cmGeneratorTarget const* target, ImportPropertyMap const& properties,
-  const std::string& importedXcFrameworkLocation)
+  std::string const& importedXcFrameworkLocation)
 {
   // Construct the imported target name.
   std::string targetName = this->Namespace;
@@ -1266,8 +1266,8 @@ void cmExportFileGenerator::GenerateFindDependencyCalls(std::ostream& os)
                               packageDependencies.end());
   std::sort(
     packageDependenciesSorted.begin(), packageDependenciesSorted.end(),
-    [](const std::pair<std::string, cmExportSet::PackageDependency>& lhs,
-       const std::pair<std::string, cmExportSet::PackageDependency>& rhs)
+    [](std::pair<std::string, cmExportSet::PackageDependency> const& lhs,
+       std::pair<std::string, cmExportSet::PackageDependency> const& rhs)
       -> bool {
       if (lhs.second.SpecifiedIndex) {
         if (rhs.second.SpecifiedIndex) {
@@ -1390,8 +1390,8 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
 void cmExportFileGenerator::GenerateImportedFileChecksCode(
   std::ostream& os, cmGeneratorTarget* target,
   ImportPropertyMap const& properties,
-  const std::set<std::string>& importedLocations,
-  const std::string& importedXcFrameworkLocation)
+  std::set<std::string> const& importedLocations,
+  std::string const& importedXcFrameworkLocation)
 {
   // Construct the imported target name.
   std::string targetName = cmStrCat(this->Namespace, target->GetExportName());
@@ -1461,7 +1461,7 @@ bool cmExportFileGenerator::PopulateCxxModuleExportProperties(
     return true;
   }
 
-  const ModuleTargetPropertyTable exportedDirectModuleProperties[] = {
+  ModuleTargetPropertyTable const exportedDirectModuleProperties[] = {
     { "CXX_EXTENSIONS"_s, ExportWhen::Defined },
     // Always define this property as it is an intrinsic property of the target
     // and should not be inherited from the in-scope `CMAKE_CXX_MODULE_STD`
@@ -1487,7 +1487,7 @@ bool cmExportFileGenerator::PopulateCxxModuleExportProperties(
     }
   }
 
-  const ModulePropertyTable exportedModuleProperties[] = {
+  ModulePropertyTable const exportedModuleProperties[] = {
     { "INCLUDE_DIRECTORIES"_s, PropertyType::IncludePaths },
     { "COMPILE_DEFINITIONS"_s, PropertyType::Strings },
     { "COMPILE_OPTIONS"_s, PropertyType::Strings },
@@ -1520,7 +1520,7 @@ bool cmExportFileGenerator::PopulateCxxModuleExportProperties(
     }
   }
 
-  const cm::static_string_view exportedLinkModuleProperties[] = {
+  cm::static_string_view const exportedLinkModuleProperties[] = {
     "LINK_LIBRARIES"_s,
   };
   for (auto const& propName : exportedLinkModuleProperties) {
@@ -1547,7 +1547,7 @@ bool cmExportFileGenerator::PopulateExportProperties(
   cmGeneratorTarget const* gte, ImportPropertyMap& properties,
   std::string& errorMessage)
 {
-  const auto& targetProperties = gte->Target->GetProperties();
+  auto const& targetProperties = gte->Target->GetProperties();
   if (cmValue exportProperties =
         targetProperties.GetPropertyValue("EXPORT_PROPERTIES")) {
     for (auto& prop : cmList{ *exportProperties }) {

+ 20 - 20
Source/cmExportFileGenerator.h

@@ -46,17 +46,17 @@ public:
   virtual ~cmExportFileGenerator() = default;
 
   /** Set the full path to the export file to generate.  */
-  void SetExportFile(const char* mainFile);
-  const std::string& GetMainExportFileName() const;
+  void SetExportFile(char const* mainFile);
+  std::string const& GetMainExportFileName() const;
 
   /** Set the namespace in which to place exported target names.  */
-  void SetNamespace(const std::string& ns) { this->Namespace = ns; }
+  void SetNamespace(std::string const& ns) { this->Namespace = ns; }
   std::string GetNamespace() const { return this->Namespace; }
 
   void SetExportOld(bool exportOld) { this->ExportOld = exportOld; }
 
   /** Add a configuration to be exported.  */
-  void AddConfiguration(const std::string& config);
+  void AddConfiguration(std::string const& config);
 
   /** Actually generate the export file.  Returns whether there was an
       error.  */
@@ -72,37 +72,37 @@ protected:
 
   // Generate per-configuration target information to the given output
   // stream.
-  void GenerateImportConfig(std::ostream& os, const std::string& config);
+  void GenerateImportConfig(std::ostream& os, std::string const& config);
 
   // Methods to implement export file code generation.
   virtual void GeneratePolicyHeaderCode(std::ostream& os);
   virtual void GeneratePolicyFooterCode(std::ostream& os);
   virtual void GenerateImportHeaderCode(std::ostream& os,
-                                        const std::string& config = "");
+                                        std::string const& config = "");
   virtual void GenerateImportFooterCode(std::ostream& os);
   void GenerateImportVersionCode(std::ostream& os);
   virtual void GenerateImportTargetCode(std::ostream& os,
                                         cmGeneratorTarget const* target,
                                         cmStateEnums::TargetType targetType);
   virtual void GenerateImportPropertyCode(
-    std::ostream& os, const std::string& config, const std::string& suffix,
+    std::ostream& os, std::string const& config, std::string const& suffix,
     cmGeneratorTarget const* target, ImportPropertyMap const& properties,
-    const std::string& importedXcFrameworkLocation);
+    std::string const& importedXcFrameworkLocation);
   virtual void GenerateImportedFileChecksCode(
     std::ostream& os, cmGeneratorTarget* target,
     ImportPropertyMap const& properties,
-    const std::set<std::string>& importedLocations,
-    const std::string& importedXcFrameworkLocation);
+    std::set<std::string> const& importedLocations,
+    std::string const& importedXcFrameworkLocation);
   virtual void GenerateImportedFileCheckLoop(std::ostream& os);
   virtual void GenerateMissingTargetsCheckCode(std::ostream& os);
   virtual void GenerateFindDependencyCalls(std::ostream& os);
 
   virtual void GenerateExpectedTargetsCode(std::ostream& os,
-                                           const std::string& expectedTargets);
+                                           std::string const& expectedTargets);
 
   // Collect properties with detailed information about targets beyond
   // their location on disk.
-  void SetImportDetailProperties(const std::string& config,
+  void SetImportDetailProperties(std::string const& config,
                                  std::string const& suffix,
                                  cmGeneratorTarget* target,
                                  ImportPropertyMap& properties);
@@ -115,7 +115,7 @@ protected:
   template <typename T>
   void SetImportLinkProperty(std::string const& suffix,
                              cmGeneratorTarget const* target,
-                             const std::string& propName,
+                             std::string const& propName,
                              std::vector<T> const& entries,
                              ImportPropertyMap& properties,
                              ImportLinkPropertyTargetNames targetNames);
@@ -125,7 +125,7 @@ protected:
 
   /** Each subclass knows where the target files are located.  */
   virtual void GenerateImportTargetsConfig(std::ostream& os,
-                                           const std::string& config,
+                                           std::string const& config,
                                            std::string const& suffix) = 0;
 
   /** Each subclass knows how to deal with a target that is  missing from an
@@ -133,14 +133,14 @@ protected:
   virtual void HandleMissingTarget(std::string& link_libs,
                                    cmGeneratorTarget const* depender,
                                    cmGeneratorTarget* dependee) = 0;
-  void PopulateInterfaceProperty(const std::string&,
+  void PopulateInterfaceProperty(std::string const&,
                                  cmGeneratorTarget const* target,
                                  cmGeneratorExpression::PreprocessContext,
                                  ImportPropertyMap& properties);
   bool PopulateInterfaceLinkLibrariesProperty(
     cmGeneratorTarget const* target, cmGeneratorExpression::PreprocessContext,
     ImportPropertyMap& properties);
-  void PopulateInterfaceProperty(const std::string& propName,
+  void PopulateInterfaceProperty(std::string const& propName,
                                  cmGeneratorTarget const* target,
                                  ImportPropertyMap& properties);
   void PopulateCompatibleInterfaceProperties(cmGeneratorTarget const* target,
@@ -151,7 +151,7 @@ protected:
     ImportPropertyMap& properties);
   virtual void GenerateInterfaceProperties(
     cmGeneratorTarget const* target, std::ostream& os,
-    const ImportPropertyMap& properties);
+    ImportPropertyMap const& properties);
   void PopulateIncludeDirectoriesInterface(
     cmGeneratorTarget const* target,
     cmGeneratorExpression::PreprocessContext preprocessRule,
@@ -171,7 +171,7 @@ protected:
     ImportPropertyMap& properties);
 
   void SetImportLinkInterface(
-    const std::string& config, std::string const& suffix,
+    std::string const& config, std::string const& suffix,
     cmGeneratorExpression::PreprocessContext preprocessRule,
     cmGeneratorTarget const* target, ImportPropertyMap& properties);
 
@@ -241,7 +241,7 @@ protected:
   bool ExportPackageDependencies = false;
 
 private:
-  void PopulateInterfaceProperty(const std::string&, const std::string&,
+  void PopulateInterfaceProperty(std::string const&, std::string const&,
                                  cmGeneratorTarget const* target,
                                  cmGeneratorExpression::PreprocessContext,
                                  ImportPropertyMap& properties);
@@ -256,7 +256,7 @@ private:
   virtual void ReplaceInstallPrefix(std::string& input);
 
   virtual std::string InstallNameDir(cmGeneratorTarget const* target,
-                                     const std::string& config) = 0;
+                                     std::string const& config) = 0;
 
   virtual std::string GetCxxModulesDirectory() const = 0;
   virtual void GenerateCxxModuleConfigInformation(std::string const&,

+ 7 - 7
Source/cmExportInstallAndroidMKGenerator.cxx

@@ -25,7 +25,7 @@ cmExportInstallAndroidMKGenerator::cmExportInstallAndroidMKGenerator(
 }
 
 void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode(
-  std::ostream& os, const std::string&)
+  std::ostream& os, std::string const&)
 {
   std::string installDir = this->IEGen->GetDestination();
   os << "LOCAL_PATH := $(call my-dir)\n";
@@ -75,13 +75,13 @@ void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode(
 }
 
 void cmExportInstallAndroidMKGenerator::GenerateExpectedTargetsCode(
-  std::ostream&, const std::string&)
+  std::ostream&, std::string const&)
 {
 }
 
 void cmExportInstallAndroidMKGenerator::GenerateImportPropertyCode(
-  std::ostream&, const std::string&, const std::string&,
-  cmGeneratorTarget const*, ImportPropertyMap const&, const std::string&)
+  std::ostream&, std::string const&, std::string const&,
+  cmGeneratorTarget const*, ImportPropertyMap const&, std::string const&)
 {
 }
 
@@ -92,7 +92,7 @@ void cmExportInstallAndroidMKGenerator::GenerateMissingTargetsCheckCode(
 
 void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties(
   cmGeneratorTarget const* target, std::ostream& os,
-  const ImportPropertyMap& properties)
+  ImportPropertyMap const& properties)
 {
   std::string config;
   if (!this->Configurations.empty()) {
@@ -122,12 +122,12 @@ void cmExportInstallAndroidMKGenerator::GenerateImportedFileCheckLoop(
 
 void cmExportInstallAndroidMKGenerator::GenerateImportedFileChecksCode(
   std::ostream&, cmGeneratorTarget*, ImportPropertyMap const&,
-  const std::set<std::string>&, const std::string&)
+  std::set<std::string> const&, std::string const&)
 {
 }
 
 bool cmExportInstallAndroidMKGenerator::GenerateImportFileConfig(
-  const std::string&)
+  std::string const&)
 {
   return true;
 }

+ 8 - 8
Source/cmExportInstallAndroidMKGenerator.h

@@ -37,22 +37,22 @@ protected:
   void GeneratePolicyHeaderCode(std::ostream&) override {}
   void GeneratePolicyFooterCode(std::ostream&) override {}
   void GenerateImportHeaderCode(std::ostream& os,
-                                const std::string& config = "") override;
+                                std::string const& config = "") override;
   void GenerateImportFooterCode(std::ostream& os) override;
   void GenerateImportTargetCode(
     std::ostream& os, cmGeneratorTarget const* target,
     cmStateEnums::TargetType /*targetType*/) override;
   void GenerateExpectedTargetsCode(
-    std::ostream& os, const std::string& expectedTargets) override;
+    std::ostream& os, std::string const& expectedTargets) override;
   void GenerateImportPropertyCode(
-    std::ostream& os, const std::string& config, const std::string& suffix,
+    std::ostream& os, std::string const& config, std::string const& suffix,
     cmGeneratorTarget const* target, ImportPropertyMap const& properties,
-    const std::string& importedXcFrameworkLocation) override;
+    std::string const& importedXcFrameworkLocation) override;
   void GenerateMissingTargetsCheckCode(std::ostream& os) override;
   void GenerateFindDependencyCalls(std::ostream&) override {}
   void GenerateInterfaceProperties(
     cmGeneratorTarget const* target, std::ostream& os,
-    const ImportPropertyMap& properties) override;
+    ImportPropertyMap const& properties) override;
   void GenerateImportPrefix(std::ostream& os) override;
   void LoadConfigFiles(std::ostream&) override;
   void CleanupTemporaryVariables(std::ostream&) override;
@@ -60,7 +60,7 @@ protected:
   void GenerateImportedFileChecksCode(
     std::ostream& os, cmGeneratorTarget* target,
     ImportPropertyMap const& properties,
-    const std::set<std::string>& importedLocations,
-    const std::string& importedXcFrameworkLocation) override;
-  bool GenerateImportFileConfig(const std::string& config) override;
+    std::set<std::string> const& importedLocations,
+    std::string const& importedXcFrameworkLocation) override;
+  bool GenerateImportFileConfig(std::string const& config) override;
 };

+ 10 - 10
Source/cmExportInstallCMakeConfigGenerator.cxx

@@ -137,7 +137,7 @@ bool cmExportInstallCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
       return false;
     }
 
-    const bool newCMP0022Behavior =
+    bool const newCMP0022Behavior =
       gt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
       gt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
     if (newCMP0022Behavior) {
@@ -293,7 +293,7 @@ void cmExportInstallCMakeConfigGenerator::ReplaceInstallPrefix(
 }
 
 bool cmExportInstallCMakeConfigGenerator::GenerateImportFileConfig(
-  const std::string& config)
+  std::string const& config)
 {
   // Skip configurations not enabled for this export.
   if (!this->IEGen->InstallsForConfig(config)) {
@@ -337,7 +337,7 @@ bool cmExportInstallCMakeConfigGenerator::GenerateImportFileConfig(
 }
 
 void cmExportInstallCMakeConfigGenerator::GenerateImportTargetsConfig(
-  std::ostream& os, const std::string& config, std::string const& suffix)
+  std::ostream& os, std::string const& config, std::string const& suffix)
 {
   // Add each target in the set to the export.
   for (std::unique_ptr<cmTargetExport> const& te :
@@ -407,7 +407,7 @@ void cmExportInstallCMakeConfigGenerator::GenerateImportTargetsConfig(
 }
 
 void cmExportInstallCMakeConfigGenerator::SetImportLocationProperty(
-  const std::string& config, std::string const& suffix,
+  std::string const& config, std::string const& suffix,
   cmInstallTargetGenerator* itgen, ImportPropertyMap& properties,
   std::set<std::string>& importedLocations)
 {
@@ -509,7 +509,7 @@ void cmExportInstallCMakeConfigGenerator::HandleMissingTarget(
   std::string& link_libs, cmGeneratorTarget const* depender,
   cmGeneratorTarget* dependee)
 {
-  const std::string name = dependee->GetName();
+  std::string const name = dependee->GetName();
   cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator();
   auto exportInfo = this->FindNamespaces(gg, name);
   std::vector<std::string> const& exportFiles = exportInfo.first;
@@ -528,14 +528,14 @@ void cmExportInstallCMakeConfigGenerator::HandleMissingTarget(
 
 std::pair<std::vector<std::string>, std::string>
 cmExportInstallCMakeConfigGenerator::FindNamespaces(cmGlobalGenerator* gg,
-                                                    const std::string& name)
+                                                    std::string const& name)
 {
   std::vector<std::string> exportFiles;
   std::string ns;
-  const cmExportSetMap& exportSets = gg->GetExportSets();
+  cmExportSetMap const& exportSets = gg->GetExportSets();
 
   for (auto const& expIt : exportSets) {
-    const cmExportSet& exportSet = expIt.second;
+    cmExportSet const& exportSet = expIt.second;
 
     bool containsTarget = false;
     for (auto const& target : exportSet.GetTargetExports()) {
@@ -580,7 +580,7 @@ void cmExportInstallCMakeConfigGenerator::ComplainAboutMissingTarget(
 }
 
 std::string cmExportInstallCMakeConfigGenerator::InstallNameDir(
-  cmGeneratorTarget const* target, const std::string& config)
+  cmGeneratorTarget const* target, std::string const& config)
 {
   std::string install_name_dir;
 
@@ -595,7 +595,7 @@ std::string cmExportInstallCMakeConfigGenerator::InstallNameDir(
 
 namespace {
 bool EntryIsContextSensitive(
-  const std::unique_ptr<cmCompiledGeneratorExpression>& cge)
+  std::unique_ptr<cmCompiledGeneratorExpression> const& cge)
 {
   return cge->GetHadContextSensitiveCondition();
 }

+ 5 - 5
Source/cmExportInstallCMakeConfigGenerator.h

@@ -78,7 +78,7 @@ public:
 protected:
   // Implement virtual methods from the superclass.
   bool GenerateMainFile(std::ostream& os) override;
-  void GenerateImportTargetsConfig(std::ostream& os, const std::string& config,
+  void GenerateImportTargetsConfig(std::ostream& os, std::string const& config,
                                    std::string const& suffix) override;
   cmStateEnums::TargetType GetExportTargetType(
     cmTargetExport const* targetExport) const;
@@ -93,7 +93,7 @@ protected:
                                   std::vector<std::string> const& exportFiles);
 
   std::pair<std::vector<std::string>, std::string> FindNamespaces(
-    cmGlobalGenerator* gg, const std::string& name);
+    cmGlobalGenerator* gg, std::string const& name);
 
   /** Generate the relative import prefix.  */
   virtual void GenerateImportPrefix(std::ostream&);
@@ -104,17 +104,17 @@ protected:
   virtual void CleanupTemporaryVariables(std::ostream&);
 
   /** Generate a per-configuration file for the targets.  */
-  virtual bool GenerateImportFileConfig(const std::string& config);
+  virtual bool GenerateImportFileConfig(std::string const& config);
 
   /** Fill in properties indicating installed file locations.  */
-  void SetImportLocationProperty(const std::string& config,
+  void SetImportLocationProperty(std::string const& config,
                                  std::string const& suffix,
                                  cmInstallTargetGenerator* itgen,
                                  ImportPropertyMap& properties,
                                  std::set<std::string>& importedLocations);
 
   std::string InstallNameDir(cmGeneratorTarget const* target,
-                             const std::string& config) override;
+                             std::string const& config) override;
 
   std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
                                     cmTargetExport* te) override;

+ 10 - 10
Source/cmExportInstallFileGenerator.cxx

@@ -137,7 +137,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
       return false;
     }
 
-    const bool newCMP0022Behavior =
+    bool const newCMP0022Behavior =
       gt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
       gt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
     if (newCMP0022Behavior) {
@@ -290,7 +290,7 @@ void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input)
 }
 
 bool cmExportInstallFileGenerator::GenerateImportFileConfig(
-  const std::string& config)
+  std::string const& config)
 {
   // Skip configurations not enabled for this export.
   if (!this->IEGen->InstallsForConfig(config)) {
@@ -334,7 +334,7 @@ bool cmExportInstallFileGenerator::GenerateImportFileConfig(
 }
 
 void cmExportInstallFileGenerator::GenerateImportTargetsConfig(
-  std::ostream& os, const std::string& config, std::string const& suffix)
+  std::ostream& os, std::string const& config, std::string const& suffix)
 {
   // Add each target in the set to the export.
   for (std::unique_ptr<cmTargetExport> const& te :
@@ -404,7 +404,7 @@ void cmExportInstallFileGenerator::GenerateImportTargetsConfig(
 }
 
 void cmExportInstallFileGenerator::SetImportLocationProperty(
-  const std::string& config, std::string const& suffix,
+  std::string const& config, std::string const& suffix,
   cmInstallTargetGenerator* itgen, ImportPropertyMap& properties,
   std::set<std::string>& importedLocations)
 {
@@ -505,7 +505,7 @@ void cmExportInstallFileGenerator::HandleMissingTarget(
   std::string& link_libs, cmGeneratorTarget const* depender,
   cmGeneratorTarget* dependee)
 {
-  const std::string name = dependee->GetName();
+  std::string const name = dependee->GetName();
   cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator();
   auto exportInfo = this->FindNamespaces(gg, name);
   std::vector<std::string> const& exportFiles = exportInfo.first;
@@ -524,14 +524,14 @@ void cmExportInstallFileGenerator::HandleMissingTarget(
 
 std::pair<std::vector<std::string>, std::string>
 cmExportInstallFileGenerator::FindNamespaces(cmGlobalGenerator* gg,
-                                             const std::string& name)
+                                             std::string const& name)
 {
   std::vector<std::string> exportFiles;
   std::string ns;
-  const cmExportSetMap& exportSets = gg->GetExportSets();
+  cmExportSetMap const& exportSets = gg->GetExportSets();
 
   for (auto const& expIt : exportSets) {
-    const cmExportSet& exportSet = expIt.second;
+    cmExportSet const& exportSet = expIt.second;
 
     bool containsTarget = false;
     for (auto const& target : exportSet.GetTargetExports()) {
@@ -576,7 +576,7 @@ void cmExportInstallFileGenerator::ComplainAboutMissingTarget(
 }
 
 std::string cmExportInstallFileGenerator::InstallNameDir(
-  cmGeneratorTarget const* target, const std::string& config)
+  cmGeneratorTarget const* target, std::string const& config)
 {
   std::string install_name_dir;
 
@@ -591,7 +591,7 @@ std::string cmExportInstallFileGenerator::InstallNameDir(
 
 namespace {
 bool EntryIsContextSensitive(
-  const std::unique_ptr<cmCompiledGeneratorExpression>& cge)
+  std::unique_ptr<cmCompiledGeneratorExpression> const& cge)
 {
   return cge->GetHadContextSensitiveCondition();
 }

+ 5 - 5
Source/cmExportInstallFileGenerator.h

@@ -78,7 +78,7 @@ public:
 protected:
   // Implement virtual methods from the superclass.
   bool GenerateMainFile(std::ostream& os) override;
-  void GenerateImportTargetsConfig(std::ostream& os, const std::string& config,
+  void GenerateImportTargetsConfig(std::ostream& os, std::string const& config,
                                    std::string const& suffix) override;
   cmStateEnums::TargetType GetExportTargetType(
     cmTargetExport const* targetExport) const;
@@ -93,7 +93,7 @@ protected:
                                   std::vector<std::string> const& exportFiles);
 
   std::pair<std::vector<std::string>, std::string> FindNamespaces(
-    cmGlobalGenerator* gg, const std::string& name);
+    cmGlobalGenerator* gg, std::string const& name);
 
   /** Generate the relative import prefix.  */
   virtual void GenerateImportPrefix(std::ostream&);
@@ -104,17 +104,17 @@ protected:
   virtual void CleanupTemporaryVariables(std::ostream&);
 
   /** Generate a per-configuration file for the targets.  */
-  virtual bool GenerateImportFileConfig(const std::string& config);
+  virtual bool GenerateImportFileConfig(std::string const& config);
 
   /** Fill in properties indicating installed file locations.  */
-  void SetImportLocationProperty(const std::string& config,
+  void SetImportLocationProperty(std::string const& config,
                                  std::string const& suffix,
                                  cmInstallTargetGenerator* itgen,
                                  ImportPropertyMap& properties,
                                  std::set<std::string>& importedLocations);
 
   std::string InstallNameDir(cmGeneratorTarget const* target,
-                             const std::string& config) override;
+                             std::string const& config) override;
 
   std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
                                     cmTargetExport* te) override;

+ 5 - 5
Source/cmExportTryCompileFileGenerator.cxx

@@ -25,7 +25,7 @@
 class cmTargetExport;
 
 cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
-  cmGlobalGenerator* gg, const std::vector<std::string>& targets,
+  cmGlobalGenerator* gg, std::vector<std::string> const& targets,
   cmMakefile* mf, std::set<std::string> const& langs)
   : Languages(langs.begin(), langs.end())
 {
@@ -61,7 +61,7 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
 }
 
 std::string cmExportTryCompileFileGenerator::FindTargets(
-  const std::string& propName, cmGeneratorTarget const* tgt,
+  std::string const& propName, cmGeneratorTarget const* tgt,
   std::string const& language, std::set<cmGeneratorTarget const*>& emitted)
 {
   cmValue prop = tgt->GetProperty(propName);
@@ -94,7 +94,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
   std::string result = cge->Evaluate(tgt->GetLocalGenerator(), this->Config,
                                      &gDummyHead, &dagChecker, tgt, language);
 
-  const std::set<cmGeneratorTarget const*>& allTargets =
+  std::set<cmGeneratorTarget const*> const& allTargets =
     cge->GetAllTargetsSeen();
   for (cmGeneratorTarget const* target : allTargets) {
     if (emitted.insert(target).second) {
@@ -105,7 +105,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
 }
 
 void cmExportTryCompileFileGenerator::PopulateProperties(
-  const cmGeneratorTarget* target, ImportPropertyMap& properties,
+  cmGeneratorTarget const* target, ImportPropertyMap& properties,
   std::set<cmGeneratorTarget const*>& emitted)
 {
   // Look through all non-special properties.
@@ -140,7 +140,7 @@ void cmExportTryCompileFileGenerator::PopulateProperties(
 }
 
 std::string cmExportTryCompileFileGenerator::InstallNameDir(
-  cmGeneratorTarget const* target, const std::string& config)
+  cmGeneratorTarget const* target, std::string const& config)
 {
   std::string install_name_dir;
 

+ 7 - 7
Source/cmExportTryCompileFileGenerator.h

@@ -26,13 +26,13 @@ public:
                                   std::set<std::string> const& langs);
 
   /** Set the list of targets to export.  */
-  void SetConfig(const std::string& config) { this->Config = config; }
+  void SetConfig(std::string const& config) { this->Config = config; }
 
 protected:
   // Implement virtual methods from the superclass.
   bool GenerateMainFile(std::ostream& os) override;
 
-  void GenerateImportTargetsConfig(std::ostream&, const std::string&,
+  void GenerateImportTargetsConfig(std::ostream&, std::string const&,
                                    std::string const&) override
   {
   }
@@ -43,10 +43,10 @@ protected:
 
   void PopulateProperties(cmGeneratorTarget const* target,
                           ImportPropertyMap& properties,
-                          std::set<const cmGeneratorTarget*>& emitted);
+                          std::set<cmGeneratorTarget const*>& emitted);
 
   std::string InstallNameDir(cmGeneratorTarget const* target,
-                             const std::string& config) override;
+                             std::string const& config) override;
 
   std::string GetFileSetDirectories(cmGeneratorTarget* target,
                                     cmFileSet* fileSet,
@@ -62,10 +62,10 @@ protected:
   }
 
 private:
-  std::string FindTargets(const std::string& prop,
-                          const cmGeneratorTarget* tgt,
+  std::string FindTargets(std::string const& prop,
+                          cmGeneratorTarget const* tgt,
                           std::string const& language,
-                          std::set<const cmGeneratorTarget*>& emitted);
+                          std::set<cmGeneratorTarget const*>& emitted);
 
   std::vector<cmGeneratorTarget const*> Exports;
   std::string Config;