[Cmake-commits] CMake branch, master, updated. v3.15.3-1014-g9602bcf

Kitware Robot kwrobot at kitware.com
Thu Sep 12 09:22:33 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  9602bcfc62d50d7bb302b02ae3b1f9afe941bae7 (commit)
       via  1a1508c8b840ae016dc8db9da6be4cbe59d5f1aa (commit)
       via  d83bff86409c0e414046d2aeb75946037e0d2de3 (commit)
       via  a3cfb66543d307e644e4df207f2e1305200ced02 (commit)
       via  d25a5a7ec91bfa072d3cf1a302830a54506c88c0 (commit)
       via  8a18bb7cdf2478d68e11a5e532b5134ea92b3678 (commit)
      from  5bdff304847995f474797b757fe7a2755de0c1fb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9602bcfc62d50d7bb302b02ae3b1f9afe941bae7
commit 9602bcfc62d50d7bb302b02ae3b1f9afe941bae7
Merge: 1a1508c a3cfb66
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 12 13:15:31 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Sep 12 09:16:56 2019 -0400

    Merge topic 'compile-msvc-permissive-off'
    
    a3cfb66543 Add compatibility with the cl.exe /permissive- compiler option
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3803


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a1508c8b840ae016dc8db9da6be4cbe59d5f1aa
commit 1a1508c8b840ae016dc8db9da6be4cbe59d5f1aa
Merge: d83bff8 d25a5a7
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 12 13:15:09 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Sep 12 09:15:38 2019 -0400

    Merge topic 'modernize-use-auto'
    
    d25a5a7ec9 clang-tidy: modernize-use-auto
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3783


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d83bff86409c0e414046d2aeb75946037e0d2de3
commit d83bff86409c0e414046d2aeb75946037e0d2de3
Merge: 5bdff30 8a18bb7
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 12 13:14:38 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Sep 12 09:14:48 2019 -0400

    Merge topic 'free-find-commands'
    
    8a18bb7cdf cmFind*: Port away from cmCommand
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3800


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3cfb66543d307e644e4df207f2e1305200ced02
commit a3cfb66543d307e644e4df207f2e1305200ced02
Author:     Alexej Harm <alexej.h at xiphos.de>
AuthorDate: Wed Sep 11 15:26:20 2019 +0200
Commit:     Alexej Harm <alexej.h at xiphos.de>
CommitDate: Wed Sep 11 15:26:20 2019 +0200

    Add compatibility with the cl.exe /permissive- compiler option

diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h
index 873352b..0737629 100644
--- a/Source/cmUVStreambuf.h
+++ b/Source/cmUVStreambuf.h
@@ -61,7 +61,7 @@ public:
   cmBasicUVStreambuf* close();
 
 protected:
-  typename cmBasicUVStreambuf::int_type underflow() override;
+  typename cmBasicUVStreambuf<CharT, Traits>::int_type underflow() override;
   std::streamsize showmanyc() override;
 
   // FIXME: Add write support
diff --git a/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp b/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp
index 4b17875..593822a 100644
--- a/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp
+++ b/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp
@@ -10,7 +10,8 @@ std::wstring get_property(MSIHANDLE msi_handle, std::wstring const& name)
 {
   DWORD size = 0;
 
-  UINT status = MsiGetPropertyW(msi_handle, name.c_str(), L"", &size);
+  WCHAR value_buffer[] = L"";
+  UINT status = MsiGetPropertyW(msi_handle, name.c_str(), value_buffer, &size);
 
   if (status == ERROR_MORE_DATA) {
     std::vector<wchar_t> buffer(size + 1);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d25a5a7ec91bfa072d3cf1a302830a54506c88c0
commit d25a5a7ec91bfa072d3cf1a302830a54506c88c0
Author:     Regina Pfeifer <regina at mailbox.org>
AuthorDate: Wed Sep 4 22:17:22 2019 +0200
Commit:     Regina Pfeifer <regina at mailbox.org>
CommitDate: Tue Sep 10 22:21:41 2019 +0200

    clang-tidy: modernize-use-auto
    
    Set the MinTypeNameLength option to an impossibly high value in order
    to limit the diagnostics to iterators.  Leave new expressions and cast
    expressions for later.

diff --git a/.clang-tidy b/.clang-tidy
index a6378e0..a240e9c 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -12,7 +12,6 @@ misc-*,\
 modernize-*,\
 -modernize-avoid-c-arrays,\
 -modernize-deprecated-headers,\
--modernize-use-auto,\
 -modernize-use-nodiscard,\
 -modernize-use-noexcept,\
 -modernize-use-transparent-functors,\
@@ -33,4 +32,6 @@ CheckOptions:
     value: '1'
   - key:   modernize-use-equals-default.IgnoreMacros
     value: '0'
+  - key:   modernize-use-auto.MinTypeNameLength
+    value: '80'
 ...
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index d1ffcef..94530c1 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -77,8 +77,7 @@ int cmCPackIFWGenerator::PackageFiles()
 
     if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
       ifwCmd.emplace_back("-i");
-      std::set<cmCPackIFWPackage*>::iterator it =
-        this->DownloadedPackages.begin();
+      auto it = this->DownloadedPackages.begin();
       ifwArg = (*it)->Name;
       ++it;
       while (it != this->DownloadedPackages.end()) {
@@ -137,8 +136,7 @@ int cmCPackIFWGenerator::PackageFiles()
 
     if (!this->Installer.Resources.empty()) {
       ifwCmd.emplace_back("-r");
-      std::vector<std::string>::iterator it =
-        this->Installer.Resources.begin();
+      auto it = this->Installer.Resources.begin();
       std::string path = this->toplevel + "/resources/";
       ifwArg = path + *it;
       ++it;
@@ -180,8 +178,7 @@ int cmCPackIFWGenerator::PackageFiles()
     } else if (!this->DownloadedPackages.empty() &&
                !this->Installer.RemoteRepositories.empty()) {
       ifwCmd.emplace_back("-e");
-      std::set<cmCPackIFWPackage*>::iterator it =
-        this->DownloadedPackages.begin();
+      auto it = this->DownloadedPackages.begin();
       ifwArg = (*it)->Name;
       ++it;
       while (it != this->DownloadedPackages.end()) {
@@ -193,14 +190,13 @@ int cmCPackIFWGenerator::PackageFiles()
       ifwCmd.emplace_back("-i");
       ifwArg.clear();
       // Binary
-      std::set<cmCPackIFWPackage*>::iterator bit =
-        this->BinaryPackages.begin();
+      auto bit = this->BinaryPackages.begin();
       while (bit != this->BinaryPackages.end()) {
         ifwArg += (*bit)->Name + ",";
         ++bit;
       }
       // Depend
-      DependenceMap::iterator it = this->DependentPackages.begin();
+      auto it = this->DependentPackages.begin();
       ifwArg += it->second.Name;
       ++it;
       while (it != this->DependentPackages.end()) {
@@ -410,7 +406,7 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
 cmCPackComponent* cmCPackIFWGenerator::GetComponent(
   const std::string& projectName, const std::string& componentName)
 {
-  ComponentsMap::iterator cit = this->Components.find(componentName);
+  auto cit = this->Components.find(componentName);
   if (cit != this->Components.end()) {
     return &(cit->second);
   }
@@ -422,7 +418,7 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
   }
 
   std::string name = this->GetComponentPackageName(component);
-  PackagesMap::iterator pit = this->Packages.find(name);
+  auto pit = this->Packages.find(name);
   if (pit != this->Packages.end()) {
     return component;
   }
@@ -462,7 +458,7 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
   }
 
   std::string name = this->GetGroupPackageName(group);
-  PackagesMap::iterator pit = this->Packages.find(name);
+  auto pit = this->Packages.find(name);
   if (pit != this->Packages.end()) {
     return group;
   }
@@ -593,23 +589,21 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
 cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage(
   cmCPackComponentGroup* group) const
 {
-  std::map<cmCPackComponentGroup*, cmCPackIFWPackage*>::const_iterator pit =
-    this->GroupPackages.find(group);
+  auto pit = this->GroupPackages.find(group);
   return pit != this->GroupPackages.end() ? pit->second : nullptr;
 }
 
 cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
   cmCPackComponent* component) const
 {
-  std::map<cmCPackComponent*, cmCPackIFWPackage*>::const_iterator pit =
-    this->ComponentPackages.find(component);
+  auto pit = this->ComponentPackages.find(component);
   return pit != this->ComponentPackages.end() ? pit->second : nullptr;
 }
 
 cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
   const std::string& repositoryName)
 {
-  RepositoriesMap::iterator rit = this->Repositories.find(repositoryName);
+  auto rit = this->Repositories.find(repositoryName);
   if (rit != this->Repositories.end()) {
     return &(rit->second);
   }
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index fb75145..5fa8cce 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -620,7 +620,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
   // Write dependencies
   if (!compDepSet.empty()) {
     std::ostringstream dependencies;
-    std::set<DependenceStruct>::iterator it = compDepSet.begin();
+    auto it = compDepSet.begin();
     dependencies << it->NameWithCompare();
     ++it;
     while (it != compDepSet.end()) {
@@ -638,7 +638,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
   // Write automatic dependency on
   if (!compAutoDepSet.empty()) {
     std::ostringstream dependencies;
-    std::set<DependenceStruct>::iterator it = compAutoDepSet.begin();
+    auto it = compAutoDepSet.begin();
     dependencies << it->NameWithCompare();
     ++it;
     while (it != compAutoDepSet.end()) {
@@ -674,7 +674,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
   // Replaces
   if (!this->Replaces.empty()) {
     std::ostringstream replaces;
-    std::vector<std::string>::iterator it = this->Replaces.begin();
+    auto it = this->Replaces.begin();
     replaces << *it;
     ++it;
     while (it != this->Replaces.end()) {
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 4d41049..a564eb1 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -158,8 +158,7 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(
 cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal(
   const std::string& name)
 {
-  cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it =
-    this->GeneratorCreators.find(name);
+  auto it = this->GeneratorCreators.find(name);
   if (it == this->GeneratorCreators.end()) {
     return nullptr;
   }
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index 0f621cc..e8728a3 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -184,8 +184,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
     // The default behavior is to have one package by component group
     // unless CPACK_COMPONENTS_IGNORE_GROUP is specified.
     if (!ignoreGroup) {
-      std::map<std::string, cmCPackComponentGroup>::iterator mainCompGIt =
-        this->ComponentGroups.end();
+      auto mainCompGIt = this->ComponentGroups.end();
 
       std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
       for (compGIt = this->ComponentGroups.begin();
@@ -206,8 +205,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
         retval &= PackageOnePack(initialTopLevel, compGIt->first);
       }
       // Handle Orphan components (components not belonging to any groups)
-      std::map<std::string, cmCPackComponent>::iterator mainCompIt =
-        this->Components.end();
+      auto mainCompIt = this->Components.end();
       std::map<std::string, cmCPackComponent>::iterator compIt;
       for (compIt = this->Components.begin(); compIt != this->Components.end();
            ++compIt) {
@@ -251,8 +249,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
     // CPACK_COMPONENTS_IGNORE_GROUPS is set
     // We build 1 package per component
     else {
-      std::map<std::string, cmCPackComponent>::iterator mainCompIt =
-        this->Components.end();
+      auto mainCompIt = this->Components.end();
 
       std::map<std::string, cmCPackComponent>::iterator compIt;
       for (compIt = this->Components.begin(); compIt != this->Components.end();
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 772fa47..d9dd931 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -1830,9 +1830,8 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
     return 0;
   }
   std::map<std::string, std::string> fileMap;
-  std::vector<std::string>::iterator fp = filesFullPath.begin();
-  for (std::vector<std::string>::iterator f = files.begin(); f != files.end();
-       ++f, ++fp) {
+  auto fp = filesFullPath.begin();
+  for (auto f = files.begin(); f != files.end(); ++f, ++fp) {
     fileMap[*f] = *fp;
   }
 
@@ -1870,7 +1869,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
         this->StartCoverageLogXML(covLogXML);
         count++; // move on one
       }
-      std::map<std::string, std::string>::iterator i = fileMap.find(file);
+      auto i = fileMap.find(file);
       // if the file should be covered write out the header for that file
       if (i != fileMap.end()) {
         // we have a new file so count it in the output
@@ -2202,7 +2201,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine(
 
 int cmCTestCoverageHandler::GetLabelId(std::string const& label)
 {
-  LabelIdMapType::iterator i = this->LabelIdMap.find(label);
+  auto i = this->LabelIdMap.find(label);
   if (i == this->LabelIdMap.end()) {
     int n = int(this->Labels.size());
     this->Labels.push_back(label);
@@ -2273,7 +2272,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
 void cmCTestCoverageHandler::WriteXMLLabels(cmXMLWriter& xml,
                                             std::string const& source)
 {
-  LabelMapType::const_iterator li = this->SourceLabels.find(source);
+  auto li = this->SourceLabels.find(source);
   if (li != this->SourceLabels.end() && !li->second.empty()) {
     xml.StartElement("Labels");
     for (auto const& ls : li->second) {
@@ -2316,7 +2315,7 @@ bool cmCTestCoverageHandler::IsFilteredOut(std::string const& source)
   // The source is filtered out if it does not have any labels in
   // common with the filter set.
   std::string shortSrc = this->CTest->GetShortPathToFile(source.c_str());
-  LabelMapType::const_iterator li = this->SourceLabels.find(shortSrc);
+  auto li = this->SourceLabels.find(shortSrc);
   if (li != this->SourceLabels.end()) {
     return !this->IntersectsFilter(li->second);
   }
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index d3020b5..cc0b4ed 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -23,8 +23,7 @@ cmCTestGenericHandler::~cmCTestGenericHandler() = default;
 void cmCTestGenericHandler::SetOption(const std::string& op, const char* value)
 {
   if (!value) {
-    cmCTestGenericHandler::t_StringToString::iterator remit =
-      this->Options.find(op);
+    auto remit = this->Options.find(op);
     if (remit != this->Options.end()) {
       this->Options.erase(remit);
     }
@@ -39,8 +38,7 @@ void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
 {
   this->SetOption(op, value);
   if (!value) {
-    cmCTestGenericHandler::t_StringToString::iterator remit =
-      this->PersistentOptions.find(op);
+    auto remit = this->PersistentOptions.find(op);
     if (remit != this->PersistentOptions.end()) {
       this->PersistentOptions.erase(remit);
     }
@@ -62,8 +60,7 @@ void cmCTestGenericHandler::Initialize()
 
 const char* cmCTestGenericHandler::GetOption(const std::string& op)
 {
-  cmCTestGenericHandler::t_StringToString::iterator remit =
-    this->Options.find(op);
+  auto remit = this->Options.find(op);
   if (remit == this->Options.end()) {
     return nullptr;
   }
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 9bca7cb..08c850d 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -146,8 +146,7 @@ private:
 
 cmCTestP4::User cmCTestP4::GetUserData(const std::string& username)
 {
-  std::map<std::string, cmCTestP4::User>::const_iterator it =
-    Users.find(username);
+  auto it = Users.find(username);
 
   if (it == Users.end()) {
     std::vector<char const*> p4_users;
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 23c6b0d..c5bb826 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -571,8 +571,7 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
 void cmCTestRunTest::ComputeArguments()
 {
   this->Arguments.clear(); // reset because this might be a rerun
-  std::vector<std::string>::const_iterator j =
-    this->TestProperties->Args.begin();
+  auto j = this->TestProperties->Args.begin();
   ++j; // skip test name
   // find the test executable
   if (this->TestHandler->MemCheck) {
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 6d8077f..a945111 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -169,7 +169,7 @@ void cmCTestSVN::GuessBase(SVNInfo& svninfo,
        slash = svninfo.URL.find('/', slash + 1)) {
     // If the URL suffix is a prefix of at least one path then it is the base.
     std::string base = cmCTest::DecodeURL(svninfo.URL.substr(slash));
-    for (std::vector<Change>::const_iterator ci = changes.begin();
+    for (auto ci = changes.begin();
          svninfo.Base.empty() && ci != changes.end(); ++ci) {
       if (cmCTestSVNPathStarts(ci->Path, base)) {
         svninfo.Base = base;
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index f67b11a..2ece411 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -690,8 +690,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject)
     for (std::string const& l : p.Labels) {
       // first check to see if the current label is a subproject label
       bool isSubprojectLabel = false;
-      std::vector<std::string>::iterator subproject =
-        std::find(subprojects.begin(), subprojects.end(), l);
+      auto subproject = std::find(subprojects.begin(), subprojects.end(), l);
       if (subproject != subprojects.end()) {
         isSubprojectLabel = true;
       }
@@ -945,8 +944,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
   FixtureDependencies fixtureSetups;
   FixtureDependencies fixtureCleanups;
 
-  for (ListOfTests::const_iterator it = this->TestList.begin();
-       it != this->TestList.end(); ++it) {
+  for (auto it = this->TestList.begin(); it != this->TestList.end(); ++it) {
     const cmCTestTestProperties& p = *it;
 
     for (std::string const& deps : p.FixturesSetup) {
@@ -1007,8 +1005,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
       // cleanup tests depend on this test case later.
       std::pair<FixtureDepsIterator, FixtureDepsIterator> setupRange =
         fixtureSetups.equal_range(requiredFixtureName);
-      for (FixtureDepsIterator sIt = setupRange.first;
-           sIt != setupRange.second; ++sIt) {
+      for (auto sIt = setupRange.first; sIt != setupRange.second; ++sIt) {
         const std::string& setupTestName = sIt->second->Name;
         tests[i].RequireSuccessDepends.insert(setupTestName);
         if (!cmContains(tests[i].Depends, setupTestName)) {
@@ -1031,8 +1028,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
           !excludeSetupRegex.find(requiredFixtureName)) {
         std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange =
           fixtureSetups.equal_range(requiredFixtureName);
-        for (FixtureDepsIterator it = fixtureRange.first;
-             it != fixtureRange.second; ++it) {
+        for (auto it = fixtureRange.first; it != fixtureRange.second; ++it) {
           ListOfTests::const_iterator lotIt = it->second;
           const cmCTestTestProperties& p = *lotIt;
 
@@ -1063,8 +1059,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
           !excludeCleanupRegex.find(requiredFixtureName)) {
         std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange =
           fixtureCleanups.equal_range(requiredFixtureName);
-        for (FixtureDepsIterator it = fixtureRange.first;
-             it != fixtureRange.second; ++it) {
+        for (auto it = fixtureRange.first; it != fixtureRange.second; ++it) {
           ListOfTests::const_iterator lotIt = it->second;
           const cmCTestTestProperties& p = *lotIt;
 
@@ -1112,8 +1107,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
       // This cleanup test could be part of the original test list that was
       // passed in. It is then possible that no other test requires the
       // fIt fixture, so we have to check for this.
-      std::map<std::string, std::vector<size_t>>::const_iterator cIt =
-        fixtureRequirements.find(fixture);
+      auto cIt = fixtureRequirements.find(fixture);
       if (cIt != fixtureRequirements.end()) {
         const std::vector<size_t>& indices = cIt->second;
         for (size_t index : indices) {
@@ -1819,8 +1813,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformation(size_t numTests)
   std::sort(this->TestsToRun.begin(), this->TestsToRun.end(),
             std::less<int>());
   // remove duplicates
-  std::vector<int>::iterator new_end =
-    std::unique(this->TestsToRun.begin(), this->TestsToRun.end());
+  auto new_end = std::unique(this->TestsToRun.begin(), this->TestsToRun.end());
   this->TestsToRun.erase(new_end, this->TestsToRun.end());
 }
 
@@ -2257,8 +2250,7 @@ bool cmCTestTestHandler::SetTestsProperties(
             // sort the array
             std::sort(rt.Labels.begin(), rt.Labels.end());
             // remove duplicates
-            std::vector<std::string>::iterator new_end =
-              std::unique(rt.Labels.begin(), rt.Labels.end());
+            auto new_end = std::unique(rt.Labels.begin(), rt.Labels.end());
             rt.Labels.erase(new_end, rt.Labels.end());
           }
           if (key == "MEASUREMENT") {
@@ -2337,8 +2329,7 @@ bool cmCTestTestHandler::SetDirectoryProperties(
           // sort the array
           std::sort(rt.Labels.begin(), rt.Labels.end());
           // remove duplicates
-          std::vector<std::string>::iterator new_end =
-            std::unique(rt.Labels.begin(), rt.Labels.end());
+          auto new_end = std::unique(rt.Labels.begin(), rt.Labels.end());
           rt.Labels.erase(new_end, rt.Labels.end());
         }
       }
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx
index cd2bb1a..b3ef7d3 100644
--- a/Source/CTest/cmParseCacheCoverage.cxx
+++ b/Source/CTest/cmParseCacheCoverage.cxx
@@ -47,8 +47,7 @@ void cmParseCacheCoverage::RemoveUnCoveredFiles()
 {
   // loop over the coverage data computed and remove all files
   // that only have -1 or 0 for the lines.
-  cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator ci =
-    this->Coverage.TotalCoverage.begin();
+  auto ci = this->Coverage.TotalCoverage.begin();
   while (ci != this->Coverage.TotalCoverage.end()) {
     cmCTestCoverageHandlerContainer::SingleFileCoverageVector& v = ci->second;
     bool nothing = true;
diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx
index afd7dc3..596b72e 100644
--- a/Source/CTest/cmParseMumpsCoverage.cxx
+++ b/Source/CTest/cmParseMumpsCoverage.cxx
@@ -123,8 +123,7 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d)
 bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine,
                                          std::string& filepath)
 {
-  std::map<std::string, std::string>::iterator i =
-    this->RoutineToDirectory.find(routine);
+  auto i = this->RoutineToDirectory.find(routine);
   if (i != this->RoutineToDirectory.end()) {
     filepath = i->second;
     return true;
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx
index d9a8aff..0f09d7c 100644
--- a/Source/QtDialog/FirstConfigure.cxx
+++ b/Source/QtDialog/FirstConfigure.cxx
@@ -107,8 +107,7 @@ void StartCompilerSetup::setGenerators(
         ->GeneratorDefaultPlatform[QString::fromLocal8Bit(gen.name.c_str())] =
         QString::fromLocal8Bit(gen.defaultPlatform.c_str());
 
-      std::vector<std::string>::const_iterator platformIt =
-        gen.supportedPlatforms.cbegin();
+      auto platformIt = gen.supportedPlatforms.cbegin();
       while (platformIt != gen.supportedPlatforms.cend()) {
 
         this->GeneratorSupportedPlatforms.insert(
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index f1264d5..1a87028 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -20,7 +20,7 @@ bool cmAddExecutableCommand(std::vector<std::string> const& args,
   }
 
   cmMakefile& mf = status.GetMakefile();
-  std::vector<std::string>::const_iterator s = args.begin();
+  auto s = args.begin();
 
   std::string const& exename = *s;
 
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index c067aea..dc8937a 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -34,7 +34,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
   bool importTarget = false;
   bool importGlobal = false;
 
-  std::vector<std::string>::const_iterator s = args.begin();
+  auto s = args.begin();
 
   std::string const& libName = *s;
 
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 6775f9d..60b746c 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -165,14 +165,14 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem)
 {
   typename InputRange::const_iterator remIt = rem.begin();
   typename InputRange::const_iterator remEnd = rem.end();
-  const typename Range::iterator rangeEnd = r.end();
+  const auto rangeEnd = r.end();
   if (remIt == remEnd) {
     return rangeEnd;
   }
 
-  typename Range::iterator writer = r.begin();
+  auto writer = r.begin();
   std::advance(writer, *remIt);
-  typename Range::iterator pivot = writer;
+  auto pivot = writer;
   typename InputRange::value_type prevRem = *remIt;
   ++remIt;
   size_t count = 1;
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index e814d67..f19d99b 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -531,7 +531,7 @@ void CCONV* cmGetSource(void* arg, const char* name)
   cmMakefile* mf = static_cast<cmMakefile*>(arg);
   if (cmSourceFile* rsf = mf->GetSource(name)) {
     // Lookup the proxy source file object for this source.
-    cmCPluginAPISourceFileMap::iterator i = cmCPluginAPISourceFiles.find(rsf);
+    auto i = cmCPluginAPISourceFiles.find(rsf);
     if (i == cmCPluginAPISourceFiles.end()) {
       // Create a proxy source file object for this source.
       cmCPluginAPISourceFile* sf = new cmCPluginAPISourceFile;
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index f51ed0b..cd54770 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1483,8 +1483,7 @@ std::vector<std::string> cmCTest::GetLabelsForSubprojects()
   // sort the array
   std::sort(subprojects.begin(), subprojects.end());
   // remove duplicates
-  std::vector<std::string>::iterator new_end =
-    std::unique(subprojects.begin(), subprojects.end());
+  auto new_end = std::unique(subprojects.begin(), subprojects.end());
   subprojects.erase(new_end, subprojects.end());
 
   return subprojects;
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 4c8c224..e28107f 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -480,7 +480,7 @@ void cmCacheManager::OutputNewlineTruncationWarning(std::ostream& fout,
 
 void cmCacheManager::RemoveCacheEntry(const std::string& key)
 {
-  CacheEntryMap::iterator i = this->Cache.find(key);
+  auto i = this->Cache.find(key);
   if (i != this->Cache.end()) {
     this->Cache.erase(i);
   }
@@ -489,7 +489,7 @@ void cmCacheManager::RemoveCacheEntry(const std::string& key)
 cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
   const std::string& key)
 {
-  CacheEntryMap::iterator i = this->Cache.find(key);
+  auto i = this->Cache.find(key);
   if (i != this->Cache.end()) {
     return &i->second;
   }
@@ -504,7 +504,7 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(const char* key)
 const std::string* cmCacheManager::GetInitializedCacheValue(
   const std::string& key) const
 {
-  CacheEntryMap::const_iterator i = this->Cache.find(key);
+  auto i = this->Cache.find(key);
   if (i != this->Cache.end() && i->second.Initialized) {
     return &i->second.Value;
   }
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 54443f2..33286ad 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -96,7 +96,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
 
 std::string cmCommonTargetGenerator::GetFlags(const std::string& l)
 {
-  ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
+  auto i = this->FlagsByLanguage.find(l);
   if (i == this->FlagsByLanguage.end()) {
     std::string flags;
 
@@ -111,7 +111,7 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l)
 
 std::string cmCommonTargetGenerator::GetDefines(const std::string& l)
 {
-  ByLanguageMap::iterator i = this->DefinesByLanguage.find(l);
+  auto i = this->DefinesByLanguage.find(l);
   if (i == this->DefinesByLanguage.end()) {
     std::set<std::string> defines;
     this->LocalCommonGenerator->GetTargetDefines(this->GeneratorTarget,
@@ -128,7 +128,7 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string& l)
 
 std::string cmCommonTargetGenerator::GetIncludes(std::string const& l)
 {
-  ByLanguageMap::iterator i = this->IncludesByLanguage.find(l);
+  auto i = this->IncludesByLanguage.find(l);
   if (i == this->IncludesByLanguage.end()) {
     std::string includes;
     this->AddIncludeFlags(includes, l);
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index a39425c..15b0087 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -283,8 +283,7 @@ std::map<cmLinkItem, int>::iterator cmComputeLinkDepends::AllocateLinkEntry(
 {
   std::map<cmLinkItem, int>::value_type index_entry(
     item, static_cast<int>(this->EntryList.size()));
-  std::map<cmLinkItem, int>::iterator lei =
-    this->LinkEntryIndex.insert(index_entry).first;
+  auto lei = this->LinkEntryIndex.insert(index_entry).first;
   this->EntryList.emplace_back();
   this->InferredDependSets.push_back(nullptr);
   this->EntryConstraintGraph.emplace_back();
@@ -294,7 +293,7 @@ std::map<cmLinkItem, int>::iterator cmComputeLinkDepends::AllocateLinkEntry(
 int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
 {
   // Check if the item entry has already been added.
-  std::map<cmLinkItem, int>::iterator lei = this->LinkEntryIndex.find(item);
+  auto lei = this->LinkEntryIndex.find(item);
   if (lei != this->LinkEntryIndex.end()) {
     // Yes.  We do not need to follow the item's dependencies again.
     return lei->second;
@@ -394,8 +393,7 @@ void cmComputeLinkDepends::QueueSharedDependencies(
 void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
 {
   // Check if the target already has an entry.
-  std::map<cmLinkItem, int>::iterator lei =
-    this->LinkEntryIndex.find(dep.Item);
+  auto lei = this->LinkEntryIndex.find(dep.Item);
   if (lei == this->LinkEntryIndex.end()) {
     // Allocate a spot for the item entry.
     lei = this->AllocateLinkEntry(dep.Item);
@@ -719,8 +717,7 @@ void cmComputeLinkDepends::VisitEntry(int index)
   // This entry has now been seen.  Update its component.
   bool completed = false;
   int component = this->CCG->GetComponentMap()[index];
-  std::map<int, PendingComponent>::iterator mi =
-    this->PendingComponents.find(this->ComponentOrder[component]);
+  auto mi = this->PendingComponents.find(this->ComponentOrder[component]);
   if (mi != this->PendingComponents.end()) {
     // The entry is in an already pending component.
     PendingComponent& pc = mi->second;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index dd8d246..ade0f87 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1332,8 +1332,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
                                                  std::string const& file)
 {
   // Do not depend on things that do not exist.
-  std::vector<std::string>::iterator i =
-    std::find(this->Depends.begin(), this->Depends.end(), item);
+  auto i = std::find(this->Depends.begin(), this->Depends.end(), item);
   if (i != this->Depends.end()) {
     this->Depends.erase(i);
   }
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 6bf2f2d..de82782 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -140,8 +140,7 @@ void cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t,
 {
   // Lookup the index for this target.  All targets should be known by
   // this point.
-  std::map<cmGeneratorTarget const*, int>::const_iterator tii =
-    this->TargetIndex.find(t);
+  auto tii = this->TargetIndex.find(t);
   assert(tii != this->TargetIndex.end());
   int i = tii->second;
 
@@ -149,7 +148,7 @@ void cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t,
   EdgeList const& nl = this->FinalGraph[i];
   for (cmGraphEdge const& ni : nl) {
     cmGeneratorTarget const* dep = this->Targets[ni];
-    cmTargetDependSet::iterator di = deps.insert(dep).first;
+    auto di = deps.insert(dep).first;
     di->SetType(ni.IsStrong());
     di->SetBacktrace(ni.GetBacktrace());
   }
@@ -368,8 +367,7 @@ void cmComputeTargetDepends::AddTargetDepend(
   } else {
     // Lookup the index for this target.  All targets should be known by
     // this point.
-    std::map<cmGeneratorTarget const*, int>::const_iterator tii =
-      this->TargetIndex.find(dependee);
+    auto tii = this->TargetIndex.find(dependee);
     assert(tii != this->TargetIndex.end());
     int dependee_index = tii->second;
 
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 21df278..97469be 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -367,7 +367,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs,
   int reducible;
   do {
     reducible = 0;
-    cmArgumentList::iterator arg = newArgs.begin();
+    auto arg = newArgs.begin();
     while (arg != newArgs.end()) {
       if (IsKeyword(keyParenL, *arg)) {
         // search for the closing paren for this opening one
@@ -393,7 +393,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs,
         std::vector<cmExpandedCommandArgument> newArgs2;
 
         // copy to the list structure
-        cmArgumentList::iterator argP1 = arg;
+        auto argP1 = arg;
         argP1++;
         cmAppend(newArgs2, argP1, argClose);
         newArgs2.pop_back();
@@ -424,7 +424,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
   int reducible;
   do {
     reducible = 0;
-    cmArgumentList::iterator arg = newArgs.begin();
+    auto arg = newArgs.begin();
     cmArgumentList::iterator argP1;
     cmArgumentList::iterator argP2;
     while (arg != newArgs.end()) {
@@ -524,7 +524,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
   const char* def2;
   do {
     reducible = 0;
-    cmArgumentList::iterator arg = newArgs.begin();
+    auto arg = newArgs.begin();
     cmArgumentList::iterator argP1;
     cmArgumentList::iterator argP2;
     while (arg != newArgs.end()) {
@@ -700,7 +700,7 @@ bool cmConditionEvaluator::HandleLevel3(cmArgumentList& newArgs,
   int reducible;
   do {
     reducible = 0;
-    cmArgumentList::iterator arg = newArgs.begin();
+    auto arg = newArgs.begin();
     cmArgumentList::iterator argP1;
     cmArgumentList::iterator argP2;
     while (arg != newArgs.end()) {
@@ -728,7 +728,7 @@ bool cmConditionEvaluator::HandleLevel4(cmArgumentList& newArgs,
   bool rhs;
   do {
     reducible = 0;
-    cmArgumentList::iterator arg = newArgs.begin();
+    auto arg = newArgs.begin();
     cmArgumentList::iterator argP1;
     cmArgumentList::iterator argP2;
     while (arg != newArgs.end()) {
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 4a1825f..da23519 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -20,7 +20,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
     return false;
   }
 
-  std::vector<std::string>::const_iterator i = args.begin();
+  auto i = args.begin();
   std::string extraInclude;
   std::string function;
   std::vector<std::string> tests;
@@ -67,7 +67,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
   configFile += "/Templates/TestDriver.cxx.in";
   // Create the test driver file
 
-  std::vector<std::string>::const_iterator testsBegin = i;
+  auto testsBegin = i;
   std::vector<std::string> tests_func_name;
 
   // The rest of the arguments consist of a list of test source files.
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 06a442b..e8f6faf 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -33,8 +33,7 @@ bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends)
       cmMakefile* mf = this->LocalGenerator->GetMakefile();
       cmExpandList(mf->GetSafeDefinition(srcLang), pairs);
     }
-    for (std::vector<std::string>::iterator si = pairs.begin();
-         si != pairs.end();) {
+    for (auto si = pairs.begin(); si != pairs.end();) {
       // Get the source and object file.
       std::string const& src = *si++;
       if (si == pairs.end()) {
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 0f9f166..a380b41 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -438,8 +438,7 @@ void cmDependsC::TransformLine(std::string& line)
   if (!this->IncludeRegexTransform.find(line)) {
     return;
   }
-  TransformRulesType::const_iterator tri =
-    this->TransformRules.find(this->IncludeRegexTransform.match(3));
+  auto tri = this->TransformRules.find(this->IncludeRegexTransform.match(3));
   if (tri == this->TransformRules.end()) {
     return;
   }
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index c30e0bf..b657ff7 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -56,8 +56,7 @@ public:
   cmFortranSourceInfo& CreateObjectInfo(const std::string& obj,
                                         const std::string& src)
   {
-    std::map<std::string, cmFortranSourceInfo>::iterator i =
-      this->ObjectInfo.find(obj);
+    auto i = this->ObjectInfo.find(obj);
     if (i == this->ObjectInfo.end()) {
       std::map<std::string, cmFortranSourceInfo>::value_type entry(
         obj, cmFortranSourceInfo());
@@ -303,9 +302,7 @@ void cmDependsFortran::ConsiderModule(const std::string& name,
                                       const std::string& stampDir)
 {
   // Locate each required module.
-  using TargetRequiresMap = cmDependsFortranInternals::TargetRequiresMap;
-  TargetRequiresMap::iterator required =
-    this->Internal->TargetRequires.find(name);
+  auto required = this->Internal->TargetRequires.find(name);
   if (required != this->Internal->TargetRequires.end() &&
       required->second.empty()) {
     // The module is provided by a CMake target.  It will have a stamp file.
@@ -321,8 +318,6 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
                                              std::ostream& makeDepends,
                                              std::ostream& internalDepends)
 {
-  using TargetRequiresMap = cmDependsFortranInternals::TargetRequiresMap;
-
   // Get the source file for this object.
   std::string const& src = info.Source;
 
@@ -350,8 +345,7 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
 
     // The object file should depend on timestamped files for the
     // modules it uses.
-    TargetRequiresMap::const_iterator required =
-      this->Internal->TargetRequires.find(i);
+    auto required = this->Internal->TargetRequires.find(i);
     if (required == this->Internal->TargetRequires.end()) {
       abort();
     }
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index 0549cf9..0b72a94 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -39,8 +39,7 @@ void cmDynamicLoaderCache::CacheFile(const char* path,
 bool cmDynamicLoaderCache::GetCacheFile(const char* path,
                                         cmsys::DynamicLoader::LibraryHandle& p)
 {
-  std::map<std::string, cmsys::DynamicLoader::LibraryHandle>::iterator it =
-    this->CacheMap.find(path);
+  auto it = this->CacheMap.find(path);
   if (it != this->CacheMap.end()) {
     p = it->second;
     return true;
@@ -50,8 +49,7 @@ bool cmDynamicLoaderCache::GetCacheFile(const char* path,
 
 bool cmDynamicLoaderCache::FlushCache(const char* path)
 {
-  std::map<std::string, cmsys::DynamicLoader::LibraryHandle>::iterator it =
-    this->CacheMap.find(path);
+  auto it = this->CacheMap.find(path);
   bool ret = false;
   if (it != this->CacheMap.end()) {
     cmsys::DynamicLoader::CloseLibrary(it->second);
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 648a900..90250b6 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -585,8 +585,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
   unsigned int tag)
 {
   // Short-circuit if already checked.
-  std::map<unsigned int, StringEntry>::iterator dssi =
-    this->DynamicSectionStrings.find(tag);
+  auto dssi = this->DynamicSectionStrings.find(tag);
   if (dssi != this->DynamicSectionStrings.end()) {
     if (dssi->second.Position > 0) {
       return &dssi->second;
@@ -614,8 +613,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
   ELF_Shdr const& strtab = this->SectionHeaders[sec.sh_link];
 
   // Look for the requested entry.
-  for (typename std::vector<ELF_Dyn>::iterator di =
-         this->DynamicSectionEntries.begin();
+  for (auto di = this->DynamicSectionEntries.begin();
        di != this->DynamicSectionEntries.end(); ++di) {
     ELF_Dyn& dyn = *di;
     if (static_cast<tagtype>(dyn.d_tag) == static_cast<tagtype>(tag)) {
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 70f98bf..9545814 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -1185,7 +1185,7 @@ void cmExportFileGenerator::GenerateImportedFileChecksCode(
      << targetName << " ";
 
   for (std::string const& li : importedLocations) {
-    ImportPropertyMap::const_iterator pi = properties.find(li);
+    auto pi = properties.find(li);
     if (pi != properties.end()) {
       os << cmExportFileGeneratorEscape(pi->second) << " ";
     }
diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx
index 293e80c..5c3f84f 100644
--- a/Source/cmExportSetMap.cxx
+++ b/Source/cmExportSetMap.cxx
@@ -9,7 +9,7 @@
 
 cmExportSet* cmExportSetMap::operator[](const std::string& name)
 {
-  std::map<std::string, cmExportSet*>::iterator it = this->find(name);
+  auto it = this->find(name);
   if (it == this->end()) // Export set not found
   {
     it = this->insert(std::make_pair(name, new cmExportSet(name))).first;
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 5a9c54c..5a5d959 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -573,8 +573,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
       cmAppend(allIncludeDirs, cmExpandedList(systemIncludeDirs));
     }
 
-    std::vector<std::string>::const_iterator end =
-      cmRemoveDuplicates(allIncludeDirs);
+    auto end = cmRemoveDuplicates(allIncludeDirs);
 
     for (std::string const& str : cmMakeRange(allIncludeDirs.cbegin(), end)) {
       xml.StartElement("Add");
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 0956729..5a01eb2 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -307,7 +307,7 @@ void cmExtraCodeLiteGenerator::FindMatchingHeaderfiles(
     for (std::string const& ext : headerExts) {
       std::string hname = cmStrCat(headerBasename, '.', ext);
       // if it's already in the set, don't check if it exists on disk
-      std::set<std::string>::const_iterator headerIt = otherFiles.find(hname);
+      auto headerIt = otherFiles.find(hname);
       if (headerIt != otherFiles.end()) {
         break;
       }
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 43f1e12..d398018 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -800,7 +800,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
 
     // the list must contain only definition-value pairs:
     if ((defs.size() % 2) == 0) {
-      std::vector<std::string>::const_iterator di = defs.begin();
+      auto di = defs.begin();
       while (di != defs.end()) {
         std::string def = *di;
         ++di;
@@ -832,7 +832,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
 
     // the list must contain only definition-value pairs:
     if ((defs.size() % 2) == 0) {
-      std::vector<std::string>::const_iterator di = defs.begin();
+      auto di = defs.begin();
       while (di != defs.end()) {
         std::string def = *di;
         ++di;
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 52ba968..6ad8609 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -242,7 +242,7 @@ void cmExtraSublimeTextGenerator::AppendTarget(
     target->GetSourceFiles(sourceFiles,
                            makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
     for (cmSourceFile* sourceFile : sourceFiles) {
-      MapSourceFileFlags::iterator sourceFileFlagsIter =
+      auto sourceFileFlagsIter =
         sourceFileFlags.find(sourceFile->ResolveFullPath());
       if (sourceFileFlagsIter == sourceFileFlags.end()) {
         sourceFileFlagsIter =
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 3ac769c..6cff075 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -823,8 +823,7 @@ void Target::ProcessLanguage(std::string const& lang)
 
 Json::ArrayIndex Target::AddSourceGroup(cmSourceGroup* sg, Json::ArrayIndex si)
 {
-  std::unordered_map<cmSourceGroup const*, Json::ArrayIndex>::iterator i =
-    this->SourceGroupsMap.find(sg);
+  auto i = this->SourceGroupsMap.find(sg);
   if (i == this->SourceGroupsMap.end()) {
     auto sgIndex = static_cast<Json::ArrayIndex>(this->SourceGroups.size());
     i = this->SourceGroupsMap.emplace(sg, sgIndex).first;
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 36a7dc3..e8a7810 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -91,7 +91,7 @@ std::string fix_file_url_windows(const std::string& url)
 bool HandleWriteImpl(std::vector<std::string> const& args, bool append,
                      cmExecutionStatus& status)
 {
-  std::vector<std::string>::const_iterator i = args.begin();
+  auto i = args.begin();
 
   i++; // Get rid of subcommand
 
@@ -663,7 +663,7 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
   // File commands has at least one argument
   assert(args.size() > 1);
 
-  std::vector<std::string>::const_iterator i = args.begin();
+  auto i = args.begin();
 
   i++; // Get rid of subcommand
 
@@ -1585,7 +1585,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
                            cmExecutionStatus& status)
 {
 #if !defined(CMAKE_BOOTSTRAP)
-  std::vector<std::string>::const_iterator i = args.begin();
+  auto i = args.begin();
   if (args.size() < 3) {
     status.SetError("DOWNLOAD must be called with at least three arguments.");
     return false;
@@ -1955,7 +1955,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
     status.SetError("UPLOAD must be called with at least three arguments.");
     return false;
   }
-  std::vector<std::string>::const_iterator i = args.begin();
+  auto i = args.begin();
   ++i;
   std::string filename = *i;
   ++i;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 9132760..2edf67b 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -847,8 +847,7 @@ bool cmFindPackageCommand::HandlePackageMode(
       // If there are files in ConsideredConfigs, it means that FooConfig.cmake
       // have been found, but they didn't have appropriate versions.
       else if (!this->ConsideredConfigs.empty()) {
-        std::vector<ConfigFileInfo>::const_iterator duplicate_end =
-          cmRemoveDuplicates(this->ConsideredConfigs);
+        auto duplicate_end = cmRemoveDuplicates(this->ConsideredConfigs);
         e << "Could not find a configuration file for package \"" << this->Name
           << "\" that "
           << (this->VersionExact ? "exactly matches" : "is compatible with")
@@ -1080,7 +1079,7 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
     std::string tmp = foundProp;
 
     cmExpandList(tmp, foundContents, false);
-    std::vector<std::string>::iterator nameIt =
+    auto nameIt =
       std::find(foundContents.begin(), foundContents.end(), this->Name);
     if (nameIt != foundContents.end()) {
       foundContents.erase(nameIt);
@@ -1094,7 +1093,7 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
     std::string tmp = notFoundProp;
 
     cmExpandList(tmp, notFoundContents, false);
-    std::vector<std::string>::iterator nameIt =
+    auto nameIt =
       std::find(notFoundContents.begin(), notFoundContents.end(), this->Name);
     if (nameIt != notFoundContents.end()) {
       notFoundContents.erase(nameIt);
@@ -1199,8 +1198,7 @@ void cmFindPackageCommand::FillPrefixesPackageRoot()
   cmSearchPath& paths = this->LabeledPaths[PathLabel::PackageRoot];
 
   // Add the PACKAGE_ROOT_PATH from each enclosing find_package call.
-  for (std::deque<std::vector<std::string>>::const_reverse_iterator pkgPaths =
-         this->Makefile->FindPackageRootPathStack.rbegin();
+  for (auto pkgPaths = this->Makefile->FindPackageRootPathStack.rbegin();
        pkgPaths != this->Makefile->FindPackageRootPathStack.rend();
        ++pkgPaths) {
     for (std::string const& path : *pkgPaths) {
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 9420541..fdc5e50 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -80,8 +80,7 @@ bool cmFunctionHelperCommand::operator()(
 
   // define ARGV and ARGN
   std::string argvDef = cmJoin(expandedArgs, ";");
-  std::vector<std::string>::const_iterator eit =
-    expandedArgs.begin() + (this->Args.size() - 1);
+  auto eit = expandedArgs.begin() + (this->Args.size() - 1);
   std::string argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
   makefile.AddDefinition("ARGV", argvDef);
   makefile.MarkVariableAsUsed("ARGV");
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 32eb3cd..7bb6a63 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -370,9 +370,7 @@ bool cmGeneratorExpression::IsValidTargetName(const std::string& input)
 void cmCompiledGeneratorExpression::GetMaxLanguageStandard(
   const cmGeneratorTarget* tgt, std::map<std::string, std::string>& mapping)
 {
-  using MapType =
-    std::map<cmGeneratorTarget const*, std::map<std::string, std::string>>;
-  MapType::const_iterator it = this->MaxLanguageStandard.find(tgt);
+  auto it = this->MaxLanguageStandard.find(tgt);
   if (it != this->MaxLanguageStandard.end()) {
     mapping = it->second;
   }
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index df2227f..dda0abc 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -59,8 +59,7 @@ void cmGeneratorExpressionDAGChecker::Initialize()
         TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(*)
 #undef TEST_TRANSITIVE_PROPERTY_METHOD
   {
-    std::map<cmGeneratorTarget const*, std::set<std::string>>::const_iterator
-      it = top->Seen.find(this->Target);
+    auto it = top->Seen.find(this->Target);
     if (it != top->Seen.end()) {
       const std::set<std::string>& propSet = it->second;
       if (propSet.find(this->Property) != propSet.end()) {
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 11c2dcc..eb43270 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -64,8 +64,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(
     outputFileName = this->FixRelativePath(outputFileName, PathForOutput, lg);
   }
 
-  std::map<std::string, std::string>::iterator it =
-    outputFiles.find(outputFileName);
+  auto it = outputFiles.find(outputFileName);
 
   if (it != outputFiles.end()) {
     if (it->second == outputContent) {
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 7442018..c1343b2 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -30,9 +30,7 @@ std::string GeneratorExpressionContent::ProcessArbitraryContent(
 {
   std::string result;
 
-  const std::vector<
-    std::vector<cmGeneratorExpressionEvaluator*>>::const_iterator pend =
-    this->ParamChildren.end();
+  const auto pend = this->ParamChildren.end();
   for (; pit != pend; ++pit) {
     for (cmGeneratorExpressionEvaluator* pExprEval : *pit) {
       if (node->RequiresLiteralInput()) {
@@ -116,11 +114,8 @@ std::string GeneratorExpressionContent::EvaluateParameters(
 {
   const int numExpected = node->NumExpectedParameters();
   {
-    std::vector<std::vector<cmGeneratorExpressionEvaluator*>>::const_iterator
-      pit = this->ParamChildren.begin();
-    const std::vector<
-      std::vector<cmGeneratorExpressionEvaluator*>>::const_iterator pend =
-      this->ParamChildren.end();
+    auto pit = this->ParamChildren.begin();
+    const auto pend = this->ParamChildren.end();
     const bool acceptsArbitraryContent =
       node->AcceptsArbitraryContentParameter();
     int counter = 1;
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index e7effca..ba00b94 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -66,8 +66,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
   unsigned int nestedLevel = this->NestingLevel;
   ++this->NestingLevel;
 
-  std::vector<cmGeneratorExpressionToken>::const_iterator startToken =
-    this->it - 1;
+  auto startToken = this->it - 1;
 
   std::vector<cmGeneratorExpressionEvaluator*> identifier;
   while (this->it->TokenType != cmGeneratorExpressionToken::EndExpression &&
@@ -174,13 +173,9 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
     if (!parameters.empty()) {
       extendText(result, colonToken);
 
-      using EvaluatorVector = std::vector<cmGeneratorExpressionEvaluator*>;
-      using TokenVector = std::vector<cmGeneratorExpressionToken>;
-      std::vector<EvaluatorVector>::const_iterator pit = parameters.begin();
-      const std::vector<EvaluatorVector>::const_iterator pend =
-        parameters.end();
-      std::vector<TokenVector::const_iterator>::const_iterator commaIt =
-        commaTokens.begin();
+      auto pit = parameters.begin();
+      const auto pend = parameters.end();
+      auto commaIt = commaTokens.begin();
       assert(parameters.size() > commaTokens.size());
       for (; pit != pend; ++pit, ++commaIt) {
         if (!pit->empty() && !emptyParamTermination) {
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index fc7589e..134bd4a 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -204,9 +204,8 @@ void CreatePropertyGeneratorExpressions(
   std::vector<cmGeneratorTarget::TargetPropertyEntry*>& items,
   bool evaluateForBuildsystem = false)
 {
-  std::vector<cmListFileBacktrace>::const_iterator btIt = backtraces.begin();
-  for (std::vector<std::string>::const_iterator it = entries.begin();
-       it != entries.end(); ++it, ++btIt) {
+  auto btIt = backtraces.begin();
+  for (auto it = entries.begin(); it != entries.end(); ++it, ++btIt) {
     items.push_back(
       CreateTargetPropertyEntry(*it, *btIt, evaluateForBuildsystem));
   }
@@ -471,8 +470,7 @@ std::string cmGeneratorTarget::GetOutputName(
 {
   // Lookup/compute/cache the output name for this configuration.
   OutputNameKey key(config, artifact);
-  cmGeneratorTarget::OutputNameMapType::iterator i =
-    this->OutputNameMap.find(key);
+  auto i = this->OutputNameMap.find(key);
   if (i == this->OutputNameMap.end()) {
     // Add empty name in map to detect potential recursion.
     OutputNameMapType::value_type entry(key, "");
@@ -716,7 +714,7 @@ void cmGeneratorTarget::AddIncludeDirectory(const std::string& src,
 std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
   cmSourceFile const* sf) const
 {
-  SourceEntriesType::const_iterator i = this->SourceDepends.find(sf);
+  auto i = this->SourceDepends.find(sf);
   if (i != this->SourceDepends.end()) {
     return &i->second.Depends;
   }
@@ -925,8 +923,7 @@ void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf)
 bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
 {
   const_cast<cmGeneratorTarget*>(this)->ComputeObjectMapping();
-  std::set<cmSourceFile const*>::const_iterator it =
-    this->ExplicitObjectName.find(file);
+  auto it = this->ExplicitObjectName.find(file);
   return it != this->ExplicitObjectName.end();
 }
 
@@ -1108,8 +1105,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
   }
 
   using IncludeCacheType = std::map<std::string, std::vector<std::string>>;
-  IncludeCacheType::const_iterator iter =
-    this->SystemIncludesCache.find(config_upper);
+  auto iter = this->SystemIncludesCache.find(config_upper);
 
   if (iter == this->SystemIncludesCache.end()) {
     cmGeneratorExpressionDAGChecker dagChecker(
@@ -1548,7 +1544,7 @@ cmGeneratorTarget::KindedSources const& cmGeneratorTarget::GetKindedSources(
 
   // Lookup any existing link implementation for this configuration.
   std::string const key = cmSystemTools::UpperCase(config);
-  KindedSourcesMapType::iterator it = this->KindedSourcesMap.find(key);
+  auto it = this->KindedSourcesMap.find(key);
   if (it != this->KindedSourcesMap.end()) {
     if (!it->second.Initialized) {
       std::ostringstream e;
@@ -1680,8 +1676,7 @@ void cmGeneratorTarget::ComputeAllConfigSources() const
   for (size_t ci = 0; ci < configs.size(); ++ci) {
     KindedSources const& sources = this->GetKindedSources(configs[ci]);
     for (SourceAndKind const& src : sources.Sources) {
-      std::map<cmSourceFile const*, size_t>::iterator mi =
-        index.find(src.Source.Value);
+      auto mi = index.find(src.Source.Value);
       if (mi == index.end()) {
         AllConfigSource acs;
         acs.Source = src.Source.Value;
@@ -2292,7 +2287,7 @@ cmGeneratorTarget::LinkClosure const* cmGeneratorTarget::GetLinkClosure(
   const std::string& config) const
 {
   std::string key(cmSystemTools::UpperCase(config));
-  LinkClosureMapType::iterator i = this->LinkClosureMap.find(key);
+  auto i = this->LinkClosureMap.find(key);
   if (i == this->LinkClosureMap.end()) {
     LinkClosure lc;
     this->ComputeLinkClosure(config, lc);
@@ -2474,8 +2469,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
   if (!config.empty()) {
     config_upper = cmSystemTools::UpperCase(config);
   }
-  CompileInfoMapType::const_iterator i =
-    this->CompileInfoMap.find(config_upper);
+  auto i = this->CompileInfoMap.find(config_upper);
   if (i == this->CompileInfoMap.end()) {
     CompileInfo info;
     this->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir);
@@ -2500,8 +2494,7 @@ cmGeneratorTarget::GetModuleDefinitionInfo(std::string const& config) const
   if (!config.empty()) {
     config_upper = cmSystemTools::UpperCase(config);
   }
-  ModuleDefinitionInfoMapType::const_iterator i =
-    this->ModuleDefinitionInfoMap.find(config_upper);
+  auto i = this->ModuleDefinitionInfoMap.find(config_upper);
   if (i == this->ModuleDefinitionInfoMap.end()) {
     ModuleDefinitionInfo info;
     this->ComputeModuleDefinitionInfo(config, info);
@@ -2712,7 +2705,7 @@ void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf)
 
 void cmTargetTraceDependencies::FollowName(std::string const& name)
 {
-  NameMapType::iterator i = this->NameMap.find(name);
+  auto i = this->NameMap.find(name);
   if (i == this->NameMap.end()) {
     // Check if we know how to generate this file.
     cmSourceFile* sf = this->Makefile->GetSourceFileWithOutput(name);
@@ -4260,8 +4253,7 @@ void cmGeneratorTarget::GetTargetObjectNames(
 
   for (cmSourceFile const* src : objectSources) {
     // Find the object file name corresponding to this source file.
-    std::map<cmSourceFile const*, std::string>::const_iterator map_it =
-      mapping.find(src);
+    auto map_it = mapping.find(src);
     // It must exist because we populated the mapping just above.
     assert(!map_it->second.empty());
     objects.push_back(map_it->second);
@@ -4285,8 +4277,7 @@ cmGeneratorTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const
 {
   struct SourceFileFlags flags;
   this->ConstructSourceFileFlags();
-  std::map<cmSourceFile const*, SourceFileFlags>::iterator si =
-    this->SourceFlagsMap.find(sf);
+  auto si = this->SourceFlagsMap.find(sf);
   if (si != this->SourceFlagsMap.end()) {
     flags = si->second;
   } else {
@@ -4620,7 +4611,7 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
   if (!prop.empty()) {
     // Use a sorted std::vector to keep the error message sorted.
     std::vector<std::string> props;
-    std::set<std::string>::const_iterator i = emittedBools.find(prop);
+    auto i = emittedBools.find(prop);
     if (i != emittedBools.end()) {
       props.push_back(strBool);
     }
@@ -5065,7 +5056,7 @@ cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(
 {
   // Lookup any existing information for this configuration.
   std::string key(cmSystemTools::UpperCase(config));
-  cmTargetLinkInformationMap::iterator i = this->LinkInformation.find(key);
+  auto i = this->LinkInformation.find(key);
   if (i == this->LinkInformation.end()) {
     // Compute information for this configuration.
     cmComputeLinkInformation* info =
@@ -5466,7 +5457,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
   if (!config.empty()) {
     config_upper = cmSystemTools::UpperCase(config);
   }
-  OutputInfoMapType::iterator i = this->OutputInfoMap.find(config_upper);
+  auto i = this->OutputInfoMap.find(config_upper);
   if (i == this->OutputInfoMap.end()) {
     // Add empty info in map to detect potential recursion.
     OutputInfo info;
@@ -5865,7 +5856,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
     config_upper = "NOCONFIG";
   }
 
-  ImportInfoMapType::const_iterator i = this->ImportInfoMap.find(config_upper);
+  auto i = this->ImportInfoMap.find(config_upper);
   if (i == this->ImportInfoMap.end()) {
     ImportInfo info;
     this->ComputeImportInfo(config_upper, info);
@@ -6069,7 +6060,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles(
   std::vector<std::string> const& configs =
     this->Makefile->GetGeneratorConfigs();
 
-  std::vector<std::string>::const_iterator it = configs.begin();
+  auto it = configs.begin();
   const std::string& firstConfig = *it;
   this->GetSourceFilesWithoutObjectLibraries(files, firstConfig);
 
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index d078a7a..64438d5 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -24,7 +24,7 @@ bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args,
     return false;
   }
 
-  std::vector<std::string>::const_iterator i = args.begin();
+  auto i = args.begin();
   std::string const& variable = *i;
   ++i;
 
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 658f65d..09ed76d 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -177,8 +177,7 @@ void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout,
 void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
                                                  const std::string& language)
 {
-  std::map<std::string, std::string>::iterator i =
-    this->FlagsByLanguage.find(language);
+  auto i = this->FlagsByLanguage.find(language);
   if (i == this->FlagsByLanguage.end()) {
     std::string flags;
     const char* lang = language.c_str();
@@ -209,8 +208,7 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
 std::string cmGhsMultiTargetGenerator::GetDefines(const std::string& language,
                                                   std::string const& config)
 {
-  std::map<std::string, std::string>::iterator i =
-    this->DefinesByLanguage.find(language);
+  auto i = this->DefinesByLanguage.find(language);
   if (i == this->DefinesByLanguage.end()) {
     std::set<std::string> defines;
     const char* lang = language.c_str();
@@ -232,8 +230,7 @@ void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
                                                    std::string const&,
                                                    const std::string& language)
 {
-  std::map<std::string, std::string>::iterator flagsByLangI =
-    this->FlagsByLanguage.find(language);
+  auto flagsByLangI = this->FlagsByLanguage.find(language);
   if (flagsByLangI != this->FlagsByLanguage.end()) {
     if (!flagsByLangI->second.empty()) {
       std::vector<std::string> ghsCompFlags =
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 22c304e..c7a0330 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -291,8 +291,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
   // Sort the list and remove duplicates.
   std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
 #if !defined(__VMS) // The Compaq STL on VMS crashes, so accept duplicates.
-  std::vector<std::string>::iterator new_end =
-    std::unique(lfiles.begin(), lfiles.end());
+  auto new_end = std::unique(lfiles.begin(), lfiles.end());
   lfiles.erase(new_end, lfiles.end());
 #endif
 
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 3dae824..af5d279 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -582,10 +582,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
   }
 
   // sort the array
-  std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
-  std::vector<std::string>::iterator new_end =
-    std::unique(lfiles.begin(), lfiles.end());
-  lfiles.erase(new_end, lfiles.end());
+  std::sort(lfiles.begin(), lfiles.end());
+  lfiles.erase(std::unique(lfiles.begin(), lfiles.end()), lfiles.end());
 
   cmake* cm = this->GetCMakeInstance();
   if (cm->DoWriteGlobVerifyTarget()) {
@@ -2629,8 +2627,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(
     return nullptr;
   }
 
-  std::map<cmGeneratorTarget const*, cmXCodeObject*>::const_iterator const i =
-    this->XCodeObjectMap.find(t);
+  auto const i = this->XCodeObjectMap.find(t);
   if (i == this->XCodeObjectMap.end()) {
     return nullptr;
   }
@@ -2910,8 +2907,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
   }
   target += gtgt->GetName();
   s = cmStrCat(target, '/', sg->GetFullName());
-  std::map<std::string, cmXCodeObject*>::iterator it =
-    this->GroupNameMap.find(s);
+  auto it = this->GroupNameMap.find(s);
   if (it != this->GroupNameMap.end()) {
     return it->second;
   }
@@ -2956,8 +2952,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
     std::string curr_folder = cmStrCat(target, '/');
     for (auto const& folder : cmTokenize(sg->GetFullName(), "\\")) {
       curr_folder += folder;
-      std::map<std::string, cmXCodeObject*>::iterator i_folder =
-        this->GroupNameMap.find(curr_folder);
+      auto const i_folder = this->GroupNameMap.find(curr_folder);
       // Create new folder
       if (i_folder == this->GroupNameMap.end()) {
         cmXCodeObject* group = this->CreatePBXGroup(tgroup, folder);
@@ -3269,8 +3264,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
         std::string trel = this->ConvertToRelativeForMake(tfull);
 
         // Add this target to the post-build phases of its dependencies.
-        std::map<std::string, cmXCodeObject::StringVec>::const_iterator y =
-          target->GetDependTargets().find(configName);
+        auto const y = target->GetDependTargets().find(configName);
         if (y != target->GetDependTargets().end()) {
           for (auto const& deptgt : y->second) {
             makefileStream << this->PostBuildMakeTarget(deptgt, configName)
@@ -3290,8 +3284,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
         makefileStream << trel << ":";
 
         // List dependencies if any exist.
-        std::map<std::string, cmXCodeObject::StringVec>::const_iterator x =
-          target->GetDependLibraries().find(configName);
+        auto const x = target->GetDependLibraries().find(configName);
         if (x != target->GetDependLibraries().end()) {
           for (auto const& deplib : x->second) {
             std::string file = this->ConvertToRelativeForMake(deplib);
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 9b58f61..e0d545d 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -368,8 +368,7 @@ void cmGraphVizWriter::WriteConnections(
   const std::string& targetName, std::set<std::string>& insertedNodes,
   std::set<std::string>& insertedConnections, cmGeneratedFileStream& str) const
 {
-  std::map<std::string, const cmGeneratorTarget*>::const_iterator targetPtrIt =
-    this->TargetPtrs.find(targetName);
+  auto targetPtrIt = this->TargetPtrs.find(targetName);
 
   if (targetPtrIt == this->TargetPtrs.end()) // not found at all
   {
@@ -390,8 +389,7 @@ void cmGraphVizWriter::WriteConnections(
 
   for (auto const& llit : ll) {
     const std::string& libName = llit.first;
-    std::map<std::string, std::string>::const_iterator libNameIt =
-      this->TargetNamesNodes.find(libName);
+    auto libNameIt = this->TargetNamesNodes.find(libName);
 
     // can happen e.g. if GRAPHVIZ_TARGET_IGNORE_REGEX is used
     if (libNameIt == this->TargetNamesNodes.end()) {
@@ -419,8 +417,7 @@ void cmGraphVizWriter::WriteDependerConnections(
   const std::string& targetName, std::set<std::string>& insertedNodes,
   std::set<std::string>& insertedConnections, cmGeneratedFileStream& str) const
 {
-  std::map<std::string, const cmGeneratorTarget*>::const_iterator targetPtrIt =
-    this->TargetPtrs.find(targetName);
+  auto targetPtrIt = this->TargetPtrs.find(targetName);
 
   if (targetPtrIt == this->TargetPtrs.end()) // not found at all
   {
@@ -454,8 +451,7 @@ void cmGraphVizWriter::WriteDependerConnections(
     for (auto const& llit : ll) {
       if (llit.first == targetName) {
         // So this target links against targetName.
-        std::map<std::string, std::string>::const_iterator dependerNodeNameIt =
-          this->TargetNamesNodes.find(tptr.first);
+        auto dependerNodeNameIt = this->TargetNamesNodes.find(tptr.first);
 
         if (dependerNodeNameIt != this->TargetNamesNodes.end()) {
           std::string connectionName =
@@ -487,8 +483,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName,
 {
   if (insertedNodes.find(targetName) == insertedNodes.end()) {
     insertedNodes.insert(targetName);
-    std::map<std::string, std::string>::const_iterator nameIt =
-      this->TargetNamesNodes.find(targetName);
+    auto nameIt = this->TargetNamesNodes.find(targetName);
 
     str << "    \"" << nameIt->second << "\" [ label=\"" << targetName
         << "\" shape=\"" << getShapeForTarget(target) << "\"];" << std::endl;
@@ -556,8 +551,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
           }
         }
 
-        std::map<std::string, const cmGeneratorTarget*>::const_iterator tarIt =
-          this->TargetPtrs.find(libName);
+        auto tarIt = this->TargetPtrs.find(libName);
         if (tarIt == this->TargetPtrs.end()) {
           std::ostringstream ostr;
           ostr << this->GraphNodePrefix << cnt++;
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index 876bd95..a4d0a0d 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -22,7 +22,7 @@ bool cmIncludeDirectoryCommand::InitialPass(
     return true;
   }
 
-  std::vector<std::string>::const_iterator i = args.begin();
+  auto i = args.begin();
 
   bool before = this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_BEFORE");
   bool system = false;
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 11687a8..4eb5f24 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -63,7 +63,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
   // two different options
   if (args.size() > 1) {
     // now put the files into the list
-    std::vector<std::string>::const_iterator s = args.begin();
+    auto s = args.begin();
     ++s;
     // for each argument, get the files
     for (; s != args.end(); ++s) {
@@ -85,7 +85,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
     std::string const& regex = args[0];
     cmSystemTools::Glob(makefile.GetCurrentSourceDirectory(), regex, files);
 
-    std::vector<std::string>::iterator s = files.begin();
+    auto s = files.begin();
     // for each argument, get the files
     for (; s != files.end(); ++s) {
       installFiles.push_back(FindInstallSource(makefile, s->c_str()));
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 3eca0e0..31a18b5 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -52,7 +52,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
   // two different options
   if (args.size() > 1 || files_mode) {
     // for each argument, get the programs
-    std::vector<std::string>::const_iterator s = args.begin();
+    auto s = args.begin();
     if (files_mode) {
       // Skip the FILES argument in files mode.
       ++s;
@@ -67,7 +67,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
     cmSystemTools::Glob(makefile.GetCurrentSourceDirectory(), args[0],
                         programs);
 
-    std::vector<std::string>::iterator s = programs.begin();
+    auto s = programs.begin();
     // for each argument, get the programs
     for (; s != programs.end(); ++s) {
       files.push_back(FindInstallSource(makefile, s->c_str()));
diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx
index ef07e2c..30fd03d 100644
--- a/Source/cmInstallTargetsCommand.cxx
+++ b/Source/cmInstallTargetsCommand.cxx
@@ -24,7 +24,7 @@ bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
   this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
 
   cmMakefile::cmTargetMap& tgts = this->Makefile->GetTargets();
-  std::vector<std::string>::const_iterator s = args.begin();
+  auto s = args.begin();
   ++s;
   std::string runtime_dir = "/bin";
   for (; s != args.end(); ++s) {
@@ -38,7 +38,7 @@ bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
 
       runtime_dir = *s;
     } else {
-      cmMakefile::cmTargetMap::iterator ti = tgts.find(*s);
+      auto ti = tgts.find(*s);
       if (ti != tgts.end()) {
         ti->second.SetInstallPath(args[0]);
         ti->second.SetRuntimeInstallPath(runtime_dir);
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index 11f6efb..7d98b90 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -74,7 +74,7 @@ bool cmInstalledFile::HasProperty(const std::string& prop) const
 bool cmInstalledFile::GetProperty(const std::string& prop,
                                   std::string& value) const
 {
-  PropertyMapType::const_iterator i = this->Properties.find(prop);
+  auto i = this->Properties.find(prop);
   if (i == this->Properties.end()) {
     return false;
   }
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index 13f6bae..bf05310 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -15,8 +15,7 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
   }
   // add libraries, note that there is an optional prefix
   // of debug and optimized than can be used
-  for (std::vector<std::string>::const_iterator i = args.begin();
-       i != args.end(); ++i) {
+  for (auto i = args.begin(); i != args.end(); ++i) {
     if (*i == "debug") {
       ++i;
       if (i == args.end()) {
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 57eeedb..b35dc6f 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -338,8 +338,7 @@ bool HandleFindCommand(std::vector<std::string> const& args,
     return true;
   }
 
-  std::vector<std::string>::iterator it =
-    std::find(varArgsExpanded.begin(), varArgsExpanded.end(), args[2]);
+  auto it = std::find(varArgsExpanded.begin(), varArgsExpanded.end(), args[2]);
   if (it != varArgsExpanded.end()) {
     status.GetMakefile().AddDefinition(
       variableName,
@@ -441,13 +440,12 @@ bool HandleRemoveItemCommand(std::vector<std::string> const& args,
 
   std::vector<std::string> remove(args.begin() + 2, args.end());
   std::sort(remove.begin(), remove.end());
-  std::vector<std::string>::const_iterator remEnd =
-    std::unique(remove.begin(), remove.end());
-  std::vector<std::string>::const_iterator remBegin = remove.begin();
+  auto remEnd = std::unique(remove.begin(), remove.end());
+  auto remBegin = remove.begin();
 
-  std::vector<std::string>::const_iterator argsEnd =
+  auto argsEnd =
     cmRemoveMatching(varArgsExpanded, cmMakeRange(remBegin, remEnd));
-  std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
+  auto argsBegin = varArgsExpanded.cbegin();
   std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
   status.GetMakefile().AddDefinition(listName, value);
   return true;
@@ -491,9 +489,8 @@ bool HandleRemoveDuplicatesCommand(std::vector<std::string> const& args,
     return true;
   }
 
-  std::vector<std::string>::const_iterator argsEnd =
-    cmRemoveDuplicates(varArgsExpanded);
-  std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
+  auto argsEnd = cmRemoveDuplicates(varArgsExpanded);
+  auto argsBegin = varArgsExpanded.cbegin();
   std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
 
   status.GetMakefile().AddDefinition(listName, value);
@@ -1357,13 +1354,12 @@ bool HandleRemoveAtCommand(std::vector<std::string> const& args,
   }
 
   std::sort(removed.begin(), removed.end());
-  std::vector<size_t>::const_iterator remEnd =
-    std::unique(removed.begin(), removed.end());
-  std::vector<size_t>::const_iterator remBegin = removed.begin();
+  auto remEnd = std::unique(removed.begin(), removed.end());
+  auto remBegin = removed.begin();
 
-  std::vector<std::string>::const_iterator argsEnd =
+  auto argsEnd =
     cmRemoveIndices(varArgsExpanded, cmMakeRange(remBegin, remEnd));
-  std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
+  auto argsBegin = varArgsExpanded.cbegin();
   std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
 
   status.GetMakefile().AddDefinition(listName, value);
@@ -1456,9 +1452,9 @@ bool FilterRegex(std::vector<std::string> const& args, bool includeMatches,
     return false;
   }
 
-  std::vector<std::string>::iterator argsBegin = varArgsExpanded.begin();
-  std::vector<std::string>::iterator argsEnd = varArgsExpanded.end();
-  std::vector<std::string>::iterator newArgsEnd =
+  auto argsBegin = varArgsExpanded.begin();
+  auto argsEnd = varArgsExpanded.end();
+  auto newArgsEnd =
     std::remove_if(argsBegin, argsEnd, MatchesRegex(regex, includeMatches));
 
   std::string value = cmJoin(cmMakeRange(argsBegin, newArgsEnd), ";");
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5d831c9..71fe772 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -649,8 +649,7 @@ void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt)
 cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
   const std::string& name) const
 {
-  GeneratorTargetMap::const_iterator ti =
-    this->GeneratorTargetSearchIndex.find(name);
+  auto ti = this->GeneratorTargetSearchIndex.find(name);
   if (ti != this->GeneratorTargetSearchIndex.end()) {
     return ti->second;
   }
@@ -1641,8 +1640,7 @@ void cmLocalGenerator::AddLanguageFlagsForLinking(
 cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
   const std::string& name) const
 {
-  GeneratorTargetMap::const_iterator imported =
-    this->ImportedGeneratorTargets.find(name);
+  auto imported = this->ImportedGeneratorTargets.find(name);
   if (imported != this->ImportedGeneratorTargets.end()) {
     return imported->second;
   }
@@ -1843,8 +1841,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
 
   std::vector<std::string>& stds = langStdMap[lang];
 
-  std::vector<std::string>::const_iterator stdIt =
-    std::find(stds.begin(), stds.end(), standard);
+  auto stdIt = std::find(stds.begin(), stds.end(), standard);
   if (stdIt == stds.end()) {
     std::string e =
       lang + "_STANDARD is set to invalid value '" + standard + "'";
@@ -1853,8 +1850,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
     return;
   }
 
-  std::vector<std::string>::const_iterator defaultStdIt =
-    std::find(stds.begin(), stds.end(), defaultStd);
+  auto defaultStdIt = std::find(stds.begin(), stds.end(), defaultStd);
   if (defaultStdIt == stds.end()) {
     std::string e = "CMAKE_" + lang +
       "_STANDARD_DEFAULT is set to invalid value '" + std::string(defaultStd) +
@@ -2720,8 +2716,7 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(
   const std::string& sin, std::string const& dir_max)
 {
   // Look for an existing mapped name for this object file.
-  std::map<std::string, std::string>::iterator it =
-    this->UniqueObjectNamesMap.find(sin);
+  auto it = this->UniqueObjectNamesMap.find(sin);
 
   // If no entry exists create one.
   if (it == this->UniqueObjectNamesMap.end()) {
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index e28b876..1284d4d 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -386,8 +386,7 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
   }
 
   std::ostringstream cmd;
-  for (std::vector<std::string>::const_iterator li = cmdLines.begin();
-       li != cmdLines.end(); ++li)
+  for (auto li = cmdLines.begin(); li != cmdLines.end(); ++li)
 #ifdef _WIN32
   {
     if (li != cmdLines.begin()) {
@@ -531,8 +530,7 @@ void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
 void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
 {
   for (cmCustomCommand const* customCommand : this->CustomCommands) {
-    CustomCommandTargetMap::iterator i =
-      this->CustomCommandTargets.find(customCommand);
+    auto i = this->CustomCommandTargets.find(customCommand);
     assert(i != this->CustomCommandTargets.end());
 
     // A custom command may appear on multiple targets.  However, some build
@@ -544,7 +542,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
     //
     // FIXME: This won't work in certain obscure scenarios involving indirect
     // dependencies.
-    std::set<cmGeneratorTarget*>::iterator j = i->second.begin();
+    auto j = i->second.begin();
     assert(j != i->second.end());
     std::vector<std::string> ccTargetDeps;
     this->GetGlobalNinjaGenerator()->AppendTargetDependsClosure(*j,
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 320a58b..8248608 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1225,8 +1225,7 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
 
   // see if the variable has been defined before and return
   // the modified version of the variable
-  std::map<std::string, std::string>::iterator i =
-    this->MakeVariableMap.find(unmodified);
+  auto i = this->MakeVariableMap.find(unmodified);
   if (i != this->MakeVariableMap.end()) {
     return i->second;
   }
@@ -1495,8 +1494,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
 
   // Convert the string to a list and preserve empty entries.
   std::vector<std::string> pairs = cmExpandedList(pairs_string, true);
-  for (std::vector<std::string>::const_iterator i = pairs.begin();
-       i != pairs.end() && (i + 1) != pairs.end();) {
+  for (auto i = pairs.begin(); i != pairs.end() && (i + 1) != pairs.end();) {
     const std::string& depender = *i++;
     const std::string& dependee = *i++;
 
@@ -2019,10 +2017,9 @@ std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
     if (components.size() > 1) {
       // Now add the rest of the components separated by the proper slash
       // direction for this platform.
-      std::vector<std::string>::const_iterator compEnd = std::remove(
-        components.begin() + 1, components.end() - 1, std::string());
-      std::vector<std::string>::const_iterator compStart =
-        components.begin() + 1;
+      auto compEnd = std::remove(components.begin() + 1, components.end() - 1,
+                                 std::string());
+      auto compStart = components.begin() + 1;
       result += cmJoin(cmMakeRange(compStart, compEnd), slash);
       // Only the last component can be empty to avoid double slashes.
       result += slash;
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 201cc13..ef6a705 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -65,8 +65,7 @@ bool cmMacroHelperCommand::operator()(
   // set the value of argc
   std::string argcDef = std::to_string(expandedArgs.size());
 
-  std::vector<std::string>::const_iterator eit =
-    expandedArgs.begin() + (this->Args.size() - 1);
+  auto eit = expandedArgs.begin() + (this->Args.size() - 1);
   std::string expandedArgn = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
   std::string expandedArgv = cmJoin(expandedArgs, ";");
   std::vector<std::string> variables;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 411add3..5f83746 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -751,9 +751,8 @@ cmMakefile::GetExportBuildFileGenerators() const
 void cmMakefile::RemoveExportBuildFileGeneratorCMP0024(
   cmExportBuildFileGenerator* gen)
 {
-  std::vector<cmExportBuildFileGenerator*>::iterator it =
-    std::find(this->ExportBuildFileGenerators.begin(),
-              this->ExportBuildFileGenerators.end(), gen);
+  auto it = std::find(this->ExportBuildFileGenerators.begin(),
+                      this->ExportBuildFileGenerators.end(), gen);
   if (it != this->ExportBuildFileGenerators.end()) {
     this->ExportBuildFileGenerators.erase(it);
   }
@@ -829,7 +828,7 @@ void cmMakefile::AddCustomCommandToTarget(
   bool command_expand_lists, ObjectLibraryCommands objLibraryCommands)
 {
   // Find the target to which to add the custom command.
-  cmTargetMap::iterator ti = this->Targets.find(target);
+  auto ti = this->Targets.find(target);
 
   if (ti == this->Targets.end()) {
     MessageType messageType = MessageType::AUTHOR_WARNING;
@@ -1034,7 +1033,7 @@ void cmMakefile::UpdateOutputToSourceMap(
 void cmMakefile::UpdateOutputToSourceMap(std::string const& output,
                                          cmSourceFile* source)
 {
-  OutputToSourceMap::iterator i = this->OutputToSource.find(output);
+  auto i = this->OutputToSource.find(output);
   if (i != this->OutputToSource.end()) {
     // Multiple custom commands produce the same output but may
     // be attached to a different source file (MAIN_DEPENDENCY).
@@ -1110,7 +1109,7 @@ void cmMakefile::AddCustomCommandOldStyle(
     // then add the source to the target to make sure the rule is
     // included.
     if (sf && !sf->GetPropertyAsBool("__CMAKE_RULE")) {
-      cmTargetMap::iterator ti = this->Targets.find(target);
+      auto ti = this->Targets.find(target);
       if (ti != this->Targets.end()) {
         ti->second.AddSource(sf->ResolveFullPath());
       } else {
@@ -1355,9 +1354,8 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
       std::vector<std::string> defs = cmExpandedList(cdefs);
 
       // Recompose the list without the definition.
-      std::vector<std::string>::const_iterator defEnd =
-        std::remove(defs.begin(), defs.end(), define);
-      std::vector<std::string>::const_iterator defBegin = defs.begin();
+      auto defEnd = std::remove(defs.begin(), defs.end(), define);
+      auto defBegin = defs.begin();
       std::string ndefs = cmJoin(cmMakeRange(defBegin, defEnd), ";");
 
       // Store the new list.
@@ -1640,7 +1638,7 @@ void cmMakefile::Configure()
   std::vector<cmMakefile*> subdirs = this->UnConfiguredDirectories;
 
   // for each subdir recurse
-  std::vector<cmMakefile*>::iterator sdi = subdirs.begin();
+  auto sdi = subdirs.begin();
   for (; sdi != subdirs.end(); ++sdi) {
     (*sdi)->StateSnapshot.InitializeFromParent_ForSubdirsCommand();
     this->ConfigureSubDirectory(*sdi);
@@ -1954,8 +1952,7 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
   if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
     std::vector<std::string> linkLibs = cmExpandedList(linkLibsProp);
 
-    for (std::vector<std::string>::iterator j = linkLibs.begin();
-         j != linkLibs.end(); ++j) {
+    for (auto j = linkLibs.begin(); j != linkLibs.end(); ++j) {
       std::string libraryName = *j;
       cmTargetLinkLibraryType libType = GENERAL_LibraryType;
       if (libraryName == "optimized") {
@@ -2024,7 +2021,7 @@ cmTarget* cmMakefile::AddExecutable(const std::string& exeName,
 cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type,
                                    const std::string& name)
 {
-  cmTargetMap::iterator it =
+  auto it =
     this->Targets
       .emplace(name, cmTarget(name, type, cmTarget::VisibilityNormal, this))
       .first;
@@ -2071,7 +2068,7 @@ cmSourceFile* cmMakefile::GetSourceFileWithOutput(
     return this->LinearGetSourceFileWithOutput(name);
   }
   // Otherwise we use an efficient lookup map.
-  OutputToSourceMap::const_iterator o = this->OutputToSource.find(name);
+  auto o = this->OutputToSource.find(name);
   if (o != this->OutputToSource.end()) {
     return (*o).second;
   }
@@ -2188,8 +2185,7 @@ cmSourceGroup* cmMakefile::FindSourceGroup(
   const std::string& source, std::vector<cmSourceGroup>& groups) const
 {
   // First search for a group that lists the file explicitly.
-  for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin();
-       sg != groups.rend(); ++sg) {
+  for (auto sg = groups.rbegin(); sg != groups.rend(); ++sg) {
     cmSourceGroup* result = sg->MatchChildrenFiles(source);
     if (result) {
       return result;
@@ -2197,8 +2193,7 @@ cmSourceGroup* cmMakefile::FindSourceGroup(
   }
 
   // Now search for a group whose regex matches the file.
-  for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin();
-       sg != groups.rend(); ++sg) {
+  for (auto sg = groups.rbegin(); sg != groups.rend(); ++sg) {
     cmSourceGroup* result = sg->MatchChildrenRegex(source);
     if (result) {
       return result;
@@ -2281,8 +2276,7 @@ void cmMakefile::ExpandVariablesCMP0019()
   if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
     std::vector<std::string> linkLibs = cmExpandedList(linkLibsProp);
 
-    for (std::vector<std::string>::iterator l = linkLibs.begin();
-         l != linkLibs.end(); ++l) {
+    for (auto l = linkLibs.begin(); l != linkLibs.end(); ++l) {
       std::string libName = *l;
       if (libName == "optimized") {
         ++l;
@@ -3841,7 +3835,7 @@ std::vector<std::string> cmMakefile::GetPropertyKeys() const
 
 cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const
 {
-  cmTargetMap::iterator i = this->Targets.find(name);
+  auto i = this->Targets.find(name);
   if (i != this->Targets.end()) {
     return &i->second;
   }
@@ -3862,8 +3856,7 @@ cmTest* cmMakefile::CreateTest(const std::string& testName)
 
 cmTest* cmMakefile::GetTest(const std::string& testName) const
 {
-  std::map<std::string, cmTest*>::const_iterator mi =
-    this->Tests.find(testName);
+  auto mi = this->Tests.find(testName);
   if (mi != this->Tests.end()) {
     return mi->second;
   }
@@ -3908,7 +3901,7 @@ std::string cmMakefile::FormatListFileStack() const
   std::ostringstream tmp;
   size_t depth = listFiles.size();
   if (depth > 0) {
-    std::vector<std::string>::const_iterator it = listFiles.end();
+    auto it = listFiles.end();
     do {
       if (depth != listFiles.size()) {
         tmp << "\n                ";
@@ -3995,7 +3988,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
 {
   // Look for an imported target.  These take priority because they
   // are more local in scope and do not have to be globally unique.
-  TargetMap::const_iterator imported = this->ImportedTargets.find(name);
+  auto imported = this->ImportedTargets.find(name);
   if (imported != this->ImportedTargets.end()) {
     return imported->second;
   }
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 36f6809..6d71a6d 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -837,7 +837,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
       }
 
       // Create the archive with the first set of objects.
-      std::vector<std::string>::iterator osi = object_strings.begin();
+      auto osi = object_strings.begin();
       {
         vars.Objects = osi->c_str();
         for (std::string const& acc : archiveCreateCommands) {
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 35ec33e..c8cac3b 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -128,7 +128,7 @@ bool cmOrderDirectoriesConstraint::FileMayConflict(std::string const& dir,
   // Check if the file will be built by cmake.
   std::set<std::string> const& files =
     (this->GlobalGenerator->GetDirectoryContent(dir, false));
-  std::set<std::string>::const_iterator fi = files.find(name);
+  auto fi = files.find(name);
   return fi != files.end();
 }
 
@@ -186,9 +186,9 @@ bool cmOrderDirectoriesConstraintSOName::FindConflict(std::string const& dir)
     // know the soname just look at all files that start with the
     // file name.  Usually the soname starts with the library name.
     std::string base = this->FileName;
-    std::set<std::string>::const_iterator first = files.lower_bound(base);
+    auto first = files.lower_bound(base);
     ++base.back();
-    std::set<std::string>::const_iterator last = files.upper_bound(base);
+    auto last = files.upper_bound(base);
     if (first != last) {
       return true;
     }
@@ -380,7 +380,7 @@ void cmOrderDirectories::CollectOriginalDirectories()
 int cmOrderDirectories::AddOriginalDirectory(std::string const& dir)
 {
   // Add the runtime directory with a unique index.
-  std::map<std::string, int>::iterator i = this->DirectoryIndex.find(dir);
+  auto i = this->DirectoryIndex.find(dir);
   if (i == this->DirectoryIndex.end()) {
     std::map<std::string, int>::value_type entry(
       dir, static_cast<int>(this->OriginalDirectories.size()));
@@ -441,8 +441,7 @@ void cmOrderDirectories::FindConflicts()
     std::sort(cl.begin(), cl.end());
 
     // Make the edge list unique so cycle detection will be reliable.
-    ConflictList::iterator last =
-      std::unique(cl.begin(), cl.end(), cmOrderDirectoriesCompare());
+    auto last = std::unique(cl.begin(), cl.end(), cmOrderDirectoriesCompare());
     cl.erase(last, cl.end());
   }
 
@@ -553,8 +552,7 @@ bool cmOrderDirectories::IsSameDirectory(std::string const& l,
 
 std::string const& cmOrderDirectories::GetRealPath(std::string const& dir)
 {
-  std::map<std::string, std::string>::iterator i =
-    this->RealPaths.lower_bound(dir);
+  auto i = this->RealPaths.lower_bound(dir);
   if (i == this->RealPaths.end() ||
       this->RealPaths.key_comp()(dir, i->first)) {
     using value_type = std::map<std::string, std::string>::value_type;
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index c034fdd..2f4e003 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -367,8 +367,7 @@ protected:
     std::string fullPath = this->FullPath(file, extraPath);
 
     // Try to find the file's instance of cmDependInformation.
-    DependInformationMapType::const_iterator result =
-      this->DependInformationMap.find(fullPath);
+    auto result = this->DependInformationMap.find(fullPath);
     if (result != this->DependInformationMap.end()) {
       // Found an instance, return it.
       return result->second;
@@ -398,7 +397,7 @@ protected:
 
     if (m != this->DirectoryToFileToPathMap.end()) {
       FileToPathMapType& map = m->second;
-      FileToPathMapType::iterator p = map.find(fname);
+      auto p = map.find(fname);
       if (p != map.end()) {
         return p->second;
       }
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index a4dd70d..0b320b6 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -116,8 +116,8 @@ bool cmParseArgumentsCommand(std::vector<std::string> const& args,
     return false;
   }
 
-  std::vector<std::string>::const_iterator argIter = args.begin();
-  std::vector<std::string>::const_iterator argEnd = args.end();
+  auto argIter = args.begin();
+  auto argEnd = args.end();
   bool parseFromArgV = false;
   unsigned long argvStart = 0;
   if (*argIter == "PARSE_ARGV") {
diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx
index 5daaf9b..f752ed7 100644
--- a/Source/cmPropertyDefinitionMap.cxx
+++ b/Source/cmPropertyDefinitionMap.cxx
@@ -10,7 +10,7 @@ void cmPropertyDefinitionMap::DefineProperty(const std::string& name,
                                              const char* FullDescription,
                                              bool chain)
 {
-  cmPropertyDefinitionMap::iterator it = this->find(name);
+  auto it = this->find(name);
   cmPropertyDefinition* prop;
   if (it == this->end()) {
     prop = &(*this)[name];
@@ -26,7 +26,7 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const
 
 bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const
 {
-  cmPropertyDefinitionMap::const_iterator it = this->find(name);
+  auto it = this->find(name);
   if (it == this->end()) {
     return false;
   }
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index 83df335..f3c78d3 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -24,8 +24,6 @@ void MergeOptions(std::vector<std::string>& baseOpts,
                   std::vector<std::string> const& newOpts,
                   std::initializer_list<cm::string_view> valueOpts, bool isQt5)
 {
-  using Iter = std::vector<std::string>::iterator;
-  using CIter = std::vector<std::string>::const_iterator;
   if (newOpts.empty()) {
     return;
   }
@@ -35,10 +33,10 @@ void MergeOptions(std::vector<std::string>& baseOpts,
   }
 
   std::vector<std::string> extraOpts;
-  for (CIter fit = newOpts.begin(), fitEnd = newOpts.end(); fit != fitEnd;
+  for (auto fit = newOpts.begin(), fitEnd = newOpts.end(); fit != fitEnd;
        ++fit) {
     std::string const& newOpt = *fit;
-    Iter existIt = std::find(baseOpts.begin(), baseOpts.end(), newOpt);
+    auto existIt = std::find(baseOpts.begin(), baseOpts.end(), newOpt);
     if (existIt != baseOpts.end()) {
       if (newOpt.size() >= 2) {
         // Acquire the option name
@@ -55,8 +53,8 @@ void MergeOptions(std::vector<std::string>& baseOpts,
         }
         // Test if this is a value option and change the existing value
         if (!optName.empty() && cmContains(valueOpts, optName)) {
-          const Iter existItNext(existIt + 1);
-          const CIter fitNext(fit + 1);
+          const auto existItNext(existIt + 1);
+          const auto fitNext(fit + 1);
           if ((existItNext != baseOpts.end()) && (fitNext != fitEnd)) {
             *existItNext = *fitNext;
             ++fit;
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 14329c0..40ebdde 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -1797,7 +1797,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
           BaseConst().ProjectBinaryDir, BaseConst().ProjectSourceDir
         };
         for (cm::string_view const& ppath : movePaths) {
-          std::list<std::string>::iterator it = includes.begin();
+          auto it = includes.begin();
           while (it != includes.end()) {
             std::string const& path = *it;
             if (cmHasPrefix(path, ppath)) {
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 1f9aae8..aa394e5 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -320,8 +320,7 @@ std::string cmRST::ReplaceSubstitutions(std::string const& line)
     std::string::size_type start = this->Substitution.start(2);
     std::string::size_type end = this->Substitution.end(2);
     std::string substitute = this->Substitution.match(3);
-    std::map<std::string, std::string>::iterator replace =
-      this->Replace.find(substitute);
+    auto replace = this->Replace.find(substitute);
     if (replace != this->Replace.end()) {
       std::pair<std::set<std::string>::iterator, bool> replaced =
         this->Replaced.insert(substitute);
@@ -451,10 +450,10 @@ void cmRST::UnindentLines(std::vector<std::string>& lines)
     }
   }
 
-  std::vector<std::string>::const_iterator it = lines.begin();
+  auto it = lines.cbegin();
   size_t leadingEmpty = std::distance(it, cmFindNot(lines, std::string()));
 
-  std::vector<std::string>::const_reverse_iterator rit = lines.rbegin();
+  auto rit = lines.crbegin();
   size_t trailingEmpty =
     std::distance(rit, cmFindNot(cmReverseRange(lines), std::string()));
 
@@ -464,7 +463,7 @@ void cmRST::UnindentLines(std::vector<std::string>& lines)
     return;
   }
 
-  std::vector<std::string>::iterator contentEnd = cmRotate(
-    lines.begin(), lines.begin() + leadingEmpty, lines.end() - trailingEmpty);
+  auto contentEnd = cmRotate(lines.begin(), lines.begin() + leadingEmpty,
+                             lines.end() - trailingEmpty);
   lines.erase(contentEnd, lines.end());
 }
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index 33389ca..6c954a6 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -235,8 +235,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
       cmOutputConverter::SHELL);
   }
 
-  std::map<std::string, std::string>::iterator compIt =
-    this->Compilers.find(variable);
+  auto compIt = this->Compilers.find(variable);
 
   if (compIt != this->Compilers.end()) {
     std::string ret = outputConverter->ConvertToOutputForExisting(
@@ -292,8 +291,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
     return ret;
   }
 
-  std::map<std::string, std::string>::iterator mapIt =
-    this->VariableMappings.find(variable);
+  auto mapIt = this->VariableMappings.find(variable);
   if (mapIt != this->VariableMappings.end()) {
     if (variable.find("_FLAG") == std::string::npos) {
       return outputConverter->ConvertToOutputForExisting(mapIt->second);
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 7e3a340..387c3fc 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -375,8 +375,7 @@ bool HandleTestMode(cmExecutionStatus& status, std::set<std::string>& names,
 {
   // Look for tests with all names given.
   std::set<std::string>::iterator next;
-  for (std::set<std::string>::iterator ni = names.begin(); ni != names.end();
-       ni = next) {
+  for (auto ni = names.begin(); ni != names.end(); ni = next) {
     next = ni;
     ++next;
     if (cmTest* test = status.GetMakefile().GetTest(*ni)) {
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 399f1da..c239a1f 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -284,8 +284,7 @@ bool cmSourceGroupCommand::checkSingleParameterArgumentPreconditions(
   const std::string& argument, const ParsedArguments& parsedArguments,
   std::string& errorMsg) const
 {
-  ParsedArguments::const_iterator foundArgument =
-    parsedArguments.find(argument);
+  auto foundArgument = parsedArguments.find(argument);
   if (foundArgument != parsedArguments.end()) {
     const std::vector<std::string>& optionArguments = foundArgument->second;
 
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 92d17ab..751eb77 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -350,8 +350,7 @@ cmPropertyDefinition const* cmState::GetPropertyDefinition(
 bool cmState::IsPropertyDefined(const std::string& name,
                                 cmProperty::ScopeType scope) const
 {
-  std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it =
-    this->PropertyDefinitions.find(scope);
+  auto it = this->PropertyDefinitions.find(scope);
   if (it == this->PropertyDefinitions.end()) {
     return false;
   }
@@ -361,8 +360,7 @@ bool cmState::IsPropertyDefined(const std::string& name,
 bool cmState::IsPropertyChained(const std::string& name,
                                 cmProperty::ScopeType scope) const
 {
-  std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it =
-    this->PropertyDefinitions.find(scope);
+  auto it = this->PropertyDefinitions.find(scope);
   if (it == this->PropertyDefinitions.end()) {
     return false;
   }
@@ -371,8 +369,8 @@ bool cmState::IsPropertyChained(const std::string& name,
 
 void cmState::SetLanguageEnabled(std::string const& l)
 {
-  std::vector<std::string>::iterator it = std::lower_bound(
-    this->EnabledLanguages.begin(), this->EnabledLanguages.end(), l);
+  auto it = std::lower_bound(this->EnabledLanguages.begin(),
+                             this->EnabledLanguages.end(), l);
   if (it == this->EnabledLanguages.end() || *it != l) {
     this->EnabledLanguages.insert(it, l);
   }
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index df96bd3..c14bf4a 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -175,11 +175,9 @@ cmStateDirectory::cmStateDirectory(
 template <typename T, typename U>
 cmStringRange GetPropertyContent(T const& content, U contentEndPosition)
 {
-  std::vector<std::string>::const_iterator end =
-    content.begin() + contentEndPosition;
+  auto end = content.begin() + contentEndPosition;
 
-  std::vector<std::string>::const_reverse_iterator rbegin =
-    cmMakeReverseIterator(end);
+  auto rbegin = cmMakeReverseIterator(end);
   rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
 
   return cmMakeRange(rbegin.base(), end);
@@ -189,17 +187,14 @@ template <typename T, typename U, typename V>
 cmBacktraceRange GetPropertyBacktraces(T const& content, U const& backtraces,
                                        V contentEndPosition)
 {
-  std::vector<std::string>::const_iterator entryEnd =
-    content.begin() + contentEndPosition;
+  auto entryEnd = content.begin() + contentEndPosition;
 
-  std::vector<std::string>::const_reverse_iterator rbegin =
-    cmMakeReverseIterator(entryEnd);
+  auto rbegin = cmMakeReverseIterator(entryEnd);
   rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
 
-  std::vector<cmListFileBacktrace>::const_iterator it =
-    backtraces.begin() + std::distance(content.begin(), rbegin.base());
+  auto it = backtraces.begin() + std::distance(content.begin(), rbegin.base());
 
-  std::vector<cmListFileBacktrace>::const_iterator end = backtraces.end();
+  auto end = backtraces.end();
   return cmMakeRange(it, end);
 }
 
@@ -271,22 +266,17 @@ void cmStateDirectory::AppendIncludeDirectoriesEntry(
 void cmStateDirectory::PrependIncludeDirectoriesEntry(
   const std::string& vec, const cmListFileBacktrace& lfbt)
 {
-  std::vector<std::string>::iterator entryEnd =
-    this->DirectoryState->IncludeDirectories.begin() +
+  auto entryEnd = this->DirectoryState->IncludeDirectories.begin() +
     this->Snapshot_.Position->IncludeDirectoryPosition;
 
-  std::vector<std::string>::reverse_iterator rend =
-    this->DirectoryState->IncludeDirectories.rend();
-  std::vector<std::string>::reverse_iterator rbegin =
-    cmMakeReverseIterator(entryEnd);
+  auto rend = this->DirectoryState->IncludeDirectories.rend();
+  auto rbegin = cmMakeReverseIterator(entryEnd);
   rbegin = std::find(rbegin, rend, cmPropertySentinal);
 
-  std::vector<std::string>::iterator entryIt = rbegin.base();
-  std::vector<std::string>::iterator entryBegin =
-    this->DirectoryState->IncludeDirectories.begin();
+  auto entryIt = rbegin.base();
+  auto entryBegin = this->DirectoryState->IncludeDirectories.begin();
 
-  std::vector<cmListFileBacktrace>::iterator btIt =
-    this->DirectoryState->IncludeDirectoryBacktraces.begin() +
+  auto btIt = this->DirectoryState->IncludeDirectoryBacktraces.begin() +
     std::distance(entryBegin, entryIt);
 
   this->DirectoryState->IncludeDirectories.insert(entryIt, vec);
@@ -446,22 +436,17 @@ void cmStateDirectory::AppendLinkDirectoriesEntry(
 void cmStateDirectory::PrependLinkDirectoriesEntry(
   const std::string& vec, const cmListFileBacktrace& lfbt)
 {
-  std::vector<std::string>::iterator entryEnd =
-    this->DirectoryState->LinkDirectories.begin() +
+  auto entryEnd = this->DirectoryState->LinkDirectories.begin() +
     this->Snapshot_.Position->LinkDirectoriesPosition;
 
-  std::vector<std::string>::reverse_iterator rend =
-    this->DirectoryState->LinkDirectories.rend();
-  std::vector<std::string>::reverse_iterator rbegin =
-    cmMakeReverseIterator(entryEnd);
+  auto rend = this->DirectoryState->LinkDirectories.rend();
+  auto rbegin = cmMakeReverseIterator(entryEnd);
   rbegin = std::find(rbegin, rend, cmPropertySentinal);
 
-  std::vector<std::string>::iterator entryIt = rbegin.base();
-  std::vector<std::string>::iterator entryBegin =
-    this->DirectoryState->LinkDirectories.begin();
+  auto entryIt = rbegin.base();
+  auto entryBegin = this->DirectoryState->LinkDirectories.begin();
 
-  std::vector<cmListFileBacktrace>::iterator btIt =
-    this->DirectoryState->LinkDirectoriesBacktraces.begin() +
+  auto btIt = this->DirectoryState->LinkDirectoriesBacktraces.begin() +
     std::distance(entryBegin, entryIt);
 
   this->DirectoryState->LinkDirectories.insert(entryIt, vec);
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index 3c54f52..b3e33ea 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -276,22 +276,18 @@ void InitializeContentFromParent(T& parentContent, T& thisContent,
                                  U& parentBacktraces, U& thisBacktraces,
                                  V& contentEndPosition)
 {
-  std::vector<std::string>::const_iterator parentBegin = parentContent.begin();
-  std::vector<std::string>::const_iterator parentEnd = parentContent.end();
+  auto parentBegin = parentContent.begin();
+  auto parentEnd = parentContent.end();
 
-  std::vector<std::string>::const_reverse_iterator parentRbegin =
-    cmMakeReverseIterator(parentEnd);
-  std::vector<std::string>::const_reverse_iterator parentRend =
-    parentContent.rend();
+  auto parentRbegin = cmMakeReverseIterator(parentEnd);
+  auto parentRend = parentContent.rend();
   parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal);
-  std::vector<std::string>::const_iterator parentIt = parentRbegin.base();
+  auto parentIt = parentRbegin.base();
 
   thisContent = std::vector<std::string>(parentIt, parentEnd);
 
-  std::vector<cmListFileBacktrace>::const_iterator btIt =
-    parentBacktraces.begin() + std::distance(parentBegin, parentIt);
-  std::vector<cmListFileBacktrace>::const_iterator btEnd =
-    parentBacktraces.end();
+  auto btIt = parentBacktraces.begin() + std::distance(parentBegin, parentIt);
+  auto btEnd = parentBacktraces.end();
 
   thisBacktraces = std::vector<cmListFileBacktrace>(btIt, btEnd);
 
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index b7287d9..7f2813a 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1633,8 +1633,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
                                std::vector<char>& err)
 {
   line.clear();
-  std::vector<char>::iterator outiter = out.begin();
-  std::vector<char>::iterator erriter = err.begin();
+  auto outiter = out.begin();
+  auto erriter = err.begin();
   cmProcessOutput processOutput;
   std::string strdata;
   while (true) {
@@ -2540,8 +2540,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
 
     // Adjust the entry list as necessary to remove the run path
     unsigned long entriesErased = 0;
-    for (cmELF::DynamicEntryList::iterator it = dentries.begin();
-         it != dentries.end();) {
+    for (auto it = dentries.begin(); it != dentries.end();) {
       if (it->first == cmELF::TagRPath || it->first == cmELF::TagRunPath) {
         it = dentries.erase(it);
         entriesErased++;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 10ea7dd..2420810 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1361,13 +1361,11 @@ void cmTarget::AppendBuildInterfaceIncludes()
 void cmTarget::InsertInclude(std::string const& entry,
                              cmListFileBacktrace const& bt, bool before)
 {
-  std::vector<std::string>::iterator position = before
-    ? impl->IncludeDirectoriesEntries.begin()
-    : impl->IncludeDirectoriesEntries.end();
+  auto position = before ? impl->IncludeDirectoriesEntries.begin()
+                         : impl->IncludeDirectoriesEntries.end();
 
-  std::vector<cmListFileBacktrace>::iterator btPosition = before
-    ? impl->IncludeDirectoriesBacktraces.begin()
-    : impl->IncludeDirectoriesBacktraces.end();
+  auto btPosition = before ? impl->IncludeDirectoriesBacktraces.begin()
+                           : impl->IncludeDirectoriesBacktraces.end();
 
   impl->IncludeDirectoriesEntries.insert(position, entry);
   impl->IncludeDirectoriesBacktraces.insert(btPosition, bt);
@@ -1376,13 +1374,11 @@ void cmTarget::InsertInclude(std::string const& entry,
 void cmTarget::InsertCompileOption(std::string const& entry,
                                    cmListFileBacktrace const& bt, bool before)
 {
-  std::vector<std::string>::iterator position = before
-    ? impl->CompileOptionsEntries.begin()
-    : impl->CompileOptionsEntries.end();
+  auto position = before ? impl->CompileOptionsEntries.begin()
+                         : impl->CompileOptionsEntries.end();
 
-  std::vector<cmListFileBacktrace>::iterator btPosition = before
-    ? impl->CompileOptionsBacktraces.begin()
-    : impl->CompileOptionsBacktraces.end();
+  auto btPosition = before ? impl->CompileOptionsBacktraces.begin()
+                           : impl->CompileOptionsBacktraces.end();
 
   impl->CompileOptionsEntries.insert(position, entry);
   impl->CompileOptionsBacktraces.insert(btPosition, bt);
@@ -1398,12 +1394,11 @@ void cmTarget::InsertCompileDefinition(std::string const& entry,
 void cmTarget::InsertLinkOption(std::string const& entry,
                                 cmListFileBacktrace const& bt, bool before)
 {
-  std::vector<std::string>::iterator position =
+  auto position =
     before ? impl->LinkOptionsEntries.begin() : impl->LinkOptionsEntries.end();
 
-  std::vector<cmListFileBacktrace>::iterator btPosition = before
-    ? impl->LinkOptionsBacktraces.begin()
-    : impl->LinkOptionsBacktraces.end();
+  auto btPosition = before ? impl->LinkOptionsBacktraces.begin()
+                           : impl->LinkOptionsBacktraces.end();
 
   impl->LinkOptionsEntries.insert(position, entry);
   impl->LinkOptionsBacktraces.insert(btPosition, bt);
@@ -1412,13 +1407,11 @@ void cmTarget::InsertLinkOption(std::string const& entry,
 void cmTarget::InsertLinkDirectory(std::string const& entry,
                                    cmListFileBacktrace const& bt, bool before)
 {
-  std::vector<std::string>::iterator position = before
-    ? impl->LinkDirectoriesEntries.begin()
-    : impl->LinkDirectoriesEntries.end();
+  auto position = before ? impl->LinkDirectoriesEntries.begin()
+                         : impl->LinkDirectoriesEntries.end();
 
-  std::vector<cmListFileBacktrace>::iterator btPosition = before
-    ? impl->LinkDirectoriesBacktraces.begin()
-    : impl->LinkDirectoriesBacktraces.end();
+  auto btPosition = before ? impl->LinkDirectoriesBacktraces.begin()
+                           : impl->LinkDirectoriesBacktraces.end();
 
   impl->LinkDirectoriesEntries.insert(position, entry);
   impl->LinkDirectoriesBacktraces.insert(btPosition, bt);
@@ -1496,8 +1489,7 @@ static void cmTargetCheckIMPORTED_GLOBAL(const cmTarget* target,
                                          cmMakefile* context)
 {
   std::vector<cmTarget*> targets = context->GetOwnedImportedTargets();
-  std::vector<cmTarget*>::const_iterator it =
-    std::find(targets.begin(), targets.end(), target);
+  auto it = std::find(targets.begin(), targets.end(), target);
   if (it == targets.end()) {
     std::ostringstream e;
     e << "Attempt to promote imported target \"" << target->GetName()
@@ -1947,7 +1939,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
     (this->IsAIX() && this->IsExecutableWithExports());
 
   // If a mapping was found, check its configurations.
-  for (std::vector<std::string>::const_iterator mci = mappedConfigs.begin();
+  for (auto mci = mappedConfigs.begin();
        !*loc && !*imp && mci != mappedConfigs.end(); ++mci) {
     // Look for this configuration.
     if (mci->empty()) {
@@ -2018,8 +2010,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
     if (const char* iconfigs = this->GetProperty("IMPORTED_CONFIGURATIONS")) {
       cmExpandList(iconfigs, availableConfigs);
     }
-    for (std::vector<std::string>::const_iterator aci =
-           availableConfigs.begin();
+    for (auto aci = availableConfigs.begin();
          !*loc && !*imp && aci != availableConfigs.end(); ++aci) {
       suffix = cmStrCat('_', cmSystemTools::UpperCase(*aci));
       std::string locProp = cmStrCat(locPropBase, suffix);
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index 25fe4ad..6b3590f 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -20,7 +20,7 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args,
     return false;
   }
 
-  std::vector<std::string>::const_iterator arg = args.begin();
+  auto arg = args.begin();
 
   // The first argument is the cache entry name.
   std::string const& cacheEntry = *arg++;
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index 3df1420..4995da9 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -66,8 +66,7 @@ bool cmVariableWatch::VariableAccessed(const std::string& variable,
                                        int access_type, const char* newValue,
                                        const cmMakefile* mf) const
 {
-  cmVariableWatch::StringToVectorOfPairs::const_iterator mit =
-    this->WatchMap.find(variable);
+  auto mit = this->WatchMap.find(variable);
   if (mit != this->WatchMap.end()) {
     // The strategy here is to copy the list of callbacks, and ignore
     // new callbacks that existing ones may add.
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index 5009b16..fdf07bb 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -19,7 +19,7 @@ bool cmWriteFileCommand(std::vector<std::string> const& args,
     return false;
   }
   std::string message;
-  std::vector<std::string>::const_iterator i = args.begin();
+  auto i = args.begin();
 
   std::string const& fileName = *i;
   bool overwrite = true;
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index 0552676..d9be3d2 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -106,8 +106,7 @@ public:
   bool HasComment() const { return (!this->Comment.empty()); }
   cmXCodeObject* GetObject(const char* name) const
   {
-    std::map<std::string, cmXCodeObject*>::const_iterator i =
-      this->ObjectAttributes.find(name);
+    auto const i = this->ObjectAttributes.find(name);
     if (i != this->ObjectAttributes.end()) {
       return i->second;
     }
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e7c714e..170e09b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1271,8 +1271,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
     << "Configure will be re-run and you may have to reset some variables.\n"
     << "The following variables have changed:\n";
   /* clang-format on */
-  for (std::vector<std::string>::iterator i = argsSplit.begin();
-       i != argsSplit.end(); ++i) {
+  for (auto i = argsSplit.begin(); i != argsSplit.end(); ++i) {
     SaveCacheEntry save;
     save.key = *i;
     warning << *i << "= ";
@@ -2188,7 +2187,7 @@ int cmake::CheckBuildSystem()
   }
 
   // Find the newest dependency.
-  std::vector<std::string>::iterator dep = depends.begin();
+  auto dep = depends.begin();
   std::string dep_newest = *dep++;
   for (; dep != depends.end(); ++dep) {
     int result = 0;
@@ -2206,7 +2205,7 @@ int cmake::CheckBuildSystem()
   }
 
   // Find the oldest output.
-  std::vector<std::string>::iterator out = outputs.begin();
+  auto out = outputs.begin();
   std::string out_oldest = *out++;
   for (; out != outputs.end(); ++out) {
     int result = 0;
@@ -2308,8 +2307,7 @@ bool cmake::GetPropertyAsBool(const std::string& prop)
 cmInstalledFile* cmake::GetOrCreateInstalledFile(cmMakefile* mf,
                                                  const std::string& name)
 {
-  std::map<std::string, cmInstalledFile>::iterator i =
-    this->InstalledFiles.find(name);
+  auto i = this->InstalledFiles.find(name);
 
   if (i != this->InstalledFiles.end()) {
     cmInstalledFile& file = i->second;
@@ -2322,8 +2320,7 @@ cmInstalledFile* cmake::GetOrCreateInstalledFile(cmMakefile* mf,
 
 cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const
 {
-  std::map<std::string, cmInstalledFile>::const_iterator i =
-    this->InstalledFiles.find(name);
+  auto i = this->InstalledFiles.find(name);
 
   if (i != this->InstalledFiles.end()) {
     cmInstalledFile const& file = i->second;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index e6dd99a..ba2ba33 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1730,7 +1730,7 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg,
 {
   // Parse our own arguments.
   std::string intDir;
-  std::vector<std::string>::const_iterator arg = argBeg;
+  auto arg = argBeg;
   while (arg != argEnd && cmHasLiteralPrefix(*arg, "-")) {
     if (*arg == "--") {
       ++arg;
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index b1541e2..010e17a 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -18,7 +18,7 @@ public:
   public:
     std::string const& at(std::string const& k) const
     {
-      const_iterator i = this->find(k);
+      auto i = this->find(k);
       if (i != this->end()) {
         return i->second;
       }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a18bb7cdf2478d68e11a5e532b5134ea92b3678
commit 8a18bb7cdf2478d68e11a5e532b5134ea92b3678
Author:     Regina Pfeifer <regina at mailbox.org>
AuthorDate: Tue Sep 10 21:44:48 2019 +0200
Commit:     Regina Pfeifer <regina at mailbox.org>
CommitDate: Tue Sep 10 22:13:11 2019 +0200

    cmFind*: Port away from cmCommand

diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 702b743..dfe130e 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -125,14 +125,11 @@ void GetScriptingCommands(cmState* state)
   state->AddBuiltinCommand("exec_program", cmExecProgramCommand);
   state->AddBuiltinCommand("execute_process", cmExecuteProcessCommand);
   state->AddBuiltinCommand("file", cmFileCommand);
-  state->AddBuiltinCommand("find_file", cm::make_unique<cmFindFileCommand>());
-  state->AddBuiltinCommand("find_library",
-                           cm::make_unique<cmFindLibraryCommand>());
-  state->AddBuiltinCommand("find_package",
-                           cm::make_unique<cmFindPackageCommand>());
-  state->AddBuiltinCommand("find_path", cm::make_unique<cmFindPathCommand>());
-  state->AddBuiltinCommand("find_program",
-                           cm::make_unique<cmFindProgramCommand>());
+  state->AddBuiltinCommand("find_file", cmFindFile);
+  state->AddBuiltinCommand("find_library", cmFindLibrary);
+  state->AddBuiltinCommand("find_package", cmFindPackage);
+  state->AddBuiltinCommand("find_path", cmFindPath);
+  state->AddBuiltinCommand("find_program", cmFindProgram);
   state->AddBuiltinCommand("foreach", cmForEachCommand);
   state->AddBuiltinCommand("function", cmFunctionCommand);
   state->AddBuiltinCommand("get_cmake_property", cmGetCMakePropertyCommand);
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index cdc5f63..e0daa4f 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -16,7 +16,10 @@
 #include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
-cmFindBase::cmFindBase()
+class cmExecutionStatus;
+
+cmFindBase::cmFindBase(cmExecutionStatus& status)
+  : cmFindCommon(status)
 {
   this->AlreadyInCache = false;
   this->AlreadyInCacheWithoutMetaInfo = false;
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index 88b5b6c..f75db5f 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -10,6 +10,8 @@
 
 #include "cmFindCommon.h"
 
+class cmExecutionStatus;
+
 /** \class cmFindBase
  * \brief Base class for most FIND_XXX commands.
  *
@@ -19,7 +21,9 @@
 class cmFindBase : public cmFindCommon
 {
 public:
-  cmFindBase();
+  cmFindBase(cmExecutionStatus& status);
+  virtual ~cmFindBase() = default;
+
   /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 9425f99..5606838 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -8,6 +8,7 @@
 #include <utility>
 
 #include "cmAlgorithms.h"
+#include "cmExecutionStatus.h"
 #include "cmMakefile.h"
 #include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
@@ -24,7 +25,9 @@ cmFindCommon::PathLabel cmFindCommon::PathLabel::SystemEnvironment(
 cmFindCommon::PathLabel cmFindCommon::PathLabel::CMakeSystem("CMAKE_SYSTEM");
 cmFindCommon::PathLabel cmFindCommon::PathLabel::Guess("GUESS");
 
-cmFindCommon::cmFindCommon()
+cmFindCommon::cmFindCommon(cmExecutionStatus& status)
+  : Makefile(&status.GetMakefile())
+  , Status(status)
 {
   this->FindRootPathMode = RootPathModeBoth;
   this->NoDefaultPath = false;
@@ -51,7 +54,10 @@ cmFindCommon::cmFindCommon()
   this->InitializeSearchPathGroups();
 }
 
-cmFindCommon::~cmFindCommon() = default;
+void cmFindCommon::SetError(std::string const& e)
+{
+  this->Status.SetError(e);
+}
 
 void cmFindCommon::InitializeSearchPathGroups()
 {
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index d95eeb1..8177eac 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -10,10 +10,12 @@
 #include <string>
 #include <vector>
 
-#include "cmCommand.h"
 #include "cmPathLabel.h"
 #include "cmSearchPath.h"
 
+class cmExecutionStatus;
+class cmMakefile;
+
 /** \class cmFindCommon
  * \brief Base class for FIND_XXX implementations.
  *
@@ -21,11 +23,12 @@
  * cmFindProgramCommand, cmFindPathCommand, cmFindLibraryCommand,
  * cmFindFileCommand, and cmFindPackageCommand.
  */
-class cmFindCommon : public cmCommand
+class cmFindCommon
 {
 public:
-  cmFindCommon();
-  ~cmFindCommon() override;
+  cmFindCommon(cmExecutionStatus& status);
+
+  void SetError(std::string const& e);
 
 protected:
   friend class cmSearchPath;
@@ -127,6 +130,9 @@ protected:
   bool SearchAppBundleFirst;
   bool SearchAppBundleOnly;
   bool SearchAppBundleLast;
+
+  cmMakefile* Makefile;
+  cmExecutionStatus& Status;
 };
 
 #endif
diff --git a/Source/cmFindFileCommand.cxx b/Source/cmFindFileCommand.cxx
index 9840c4f..29a2bc4 100644
--- a/Source/cmFindFileCommand.cxx
+++ b/Source/cmFindFileCommand.cxx
@@ -2,7 +2,16 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmFindFileCommand.h"
 
-cmFindFileCommand::cmFindFileCommand()
+class cmExecutionStatus;
+
+cmFindFileCommand::cmFindFileCommand(cmExecutionStatus& status)
+  : cmFindPathCommand(status)
 {
   this->IncludeFileInPath = true;
 }
+
+bool cmFindFile(std::vector<std::string> const& args,
+                cmExecutionStatus& status)
+{
+  return cmFindFileCommand(status).InitialPass(args);
+}
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index 152b505..7dc6e55 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -5,11 +5,13 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
-#include "cm_memory.hxx"
+#include <string>
+#include <vector>
 
-#include "cmCommand.h"
 #include "cmFindPathCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmFindFileCommand
  * \brief Define a command to search for an executable program.
  *
@@ -21,14 +23,10 @@
 class cmFindFileCommand : public cmFindPathCommand
 {
 public:
-  cmFindFileCommand();
-  /**
-   * This is a virtual constructor for the command.
-   */
-  std::unique_ptr<cmCommand> Clone() override
-  {
-    return cm::make_unique<cmFindFileCommand>();
-  }
+  cmFindFileCommand(cmExecutionStatus& status);
 };
 
+bool cmFindFile(std::vector<std::string> const& args,
+                cmExecutionStatus& status);
+
 #endif
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 92c64c8..529e5c8 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -18,15 +18,15 @@
 
 class cmExecutionStatus;
 
-cmFindLibraryCommand::cmFindLibraryCommand()
+cmFindLibraryCommand::cmFindLibraryCommand(cmExecutionStatus& status)
+  : cmFindBase(status)
 {
   this->EnvironmentPath = "LIB";
   this->NamesPerDirAllowed = true;
 }
 
 // cmFindLibraryCommand
-bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
-                                       cmExecutionStatus&)
+bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
 {
   this->VariableDocumentation = "Path to a library.";
   this->CMakePathName = "LIBRARY";
@@ -490,3 +490,9 @@ std::string cmFindLibraryCommand::FindFrameworkLibraryDirsPerName()
   // No framework found.
   return "";
 }
+
+bool cmFindLibrary(std::vector<std::string> const& args,
+                   cmExecutionStatus& status)
+{
+  return cmFindLibraryCommand(status).InitialPass(args);
+}
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index af17d60..b2f71b3 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -8,9 +8,6 @@
 #include <string>
 #include <vector>
 
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
 #include "cmFindBase.h"
 
 class cmExecutionStatus;
@@ -25,21 +22,9 @@ class cmExecutionStatus;
 class cmFindLibraryCommand : public cmFindBase
 {
 public:
-  cmFindLibraryCommand();
-  /**
-   * This is a virtual constructor for the command.
-   */
-  std::unique_ptr<cmCommand> Clone() override
-  {
-    return cm::make_unique<cmFindLibraryCommand>();
-  }
-
-  /**
-   * This is called when the command is first encountered in
-   * the CMakeLists.txt file.
-   */
-  bool InitialPass(std::vector<std::string> const& args,
-                   cmExecutionStatus& status) override;
+  cmFindLibraryCommand(cmExecutionStatus& status);
+
+  bool InitialPass(std::vector<std::string> const& args);
 
 protected:
   void AddArchitecturePaths(const char* suffix);
@@ -57,4 +42,7 @@ private:
   std::string FindFrameworkLibraryDirsPerName();
 };
 
+bool cmFindLibrary(std::vector<std::string> const& args,
+                   cmExecutionStatus& status);
+
 #endif
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 9132760..d99b20b 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -85,7 +85,8 @@ void cmFindPackageCommand::Sort(std::vector<std::string>::iterator begin,
   // else do not sort
 }
 
-cmFindPackageCommand::cmFindPackageCommand()
+cmFindPackageCommand::cmFindPackageCommand(cmExecutionStatus& status)
+  : cmFindCommon(status)
 {
   this->CMakePathName = "PACKAGE";
   this->Quiet = false;
@@ -143,8 +144,7 @@ void cmFindPackageCommand::AppendSearchPathGroups()
     std::make_pair(PathLabel::SystemRegistry, cmSearchPath(this)));
 }
 
-bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
-                                       cmExecutionStatus&)
+bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
 {
   if (args.empty()) {
     this->SetError("called with incorrect number of arguments");
@@ -2282,3 +2282,9 @@ bool cmFindPackageCommand::SearchAppBundlePrefix(std::string const& prefix_in)
 }
 
 // TODO: Debug cmsys::Glob double slash problem.
+
+bool cmFindPackage(std::vector<std::string> const& args,
+                   cmExecutionStatus& status)
+{
+  return cmFindPackageCommand(status).InitialPass(args);
+}
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index d57b38a..78b4985 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -3,9 +3,7 @@
 #ifndef cmFindPackageCommand_h
 #define cmFindPackageCommand_h
 
-#include "cmCommand.h"
 #include "cmConfigure.h" // IWYU pragma: keep
-#include "cmPolicies.h"
 
 #include "cm_kwiml.h"
 #include <cstddef>
@@ -15,7 +13,8 @@
 #include <string>
 #include <vector>
 
-#include "cm_memory.hxx"
+#include "cmFindCommon.h"
+#include "cmPolicies.h"
 
 // IWYU insists we should forward-declare instead of including <functional>,
 // but we cannot forward-declare reliably because some C++ standard libraries
@@ -28,8 +27,6 @@ namespace std {
 /* clang-format on */
 #endif
 
-#include "cmFindCommon.h"
-
 class cmExecutionStatus;
 class cmSearchPath;
 
@@ -62,22 +59,9 @@ public:
                    std::vector<std::string>::iterator end, SortOrderType order,
                    SortDirectionType dir);
 
-  cmFindPackageCommand();
+  cmFindPackageCommand(cmExecutionStatus& status);
 
-  /**
-   * This is a virtual constructor for the command.
-   */
-  std::unique_ptr<cmCommand> Clone() override
-  {
-    return cm::make_unique<cmFindPackageCommand>();
-  }
-
-  /**
-   * This is called when the command is first encountered in
-   * the CMakeLists.txt file.
-   */
-  bool InitialPass(std::vector<std::string> const& args,
-                   cmExecutionStatus& status) override;
+  bool InitialPass(std::vector<std::string> const& args);
 
 private:
   class PathLabel : public cmFindCommon::PathLabel
@@ -246,4 +230,7 @@ struct hash<cmFindPackageCommand::ConfigFileInfo>
 };
 }
 
+bool cmFindPackage(std::vector<std::string> const& args,
+                   cmExecutionStatus& status);
+
 #endif
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 41f5e51..f5e2631 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -11,15 +11,15 @@
 
 class cmExecutionStatus;
 
-cmFindPathCommand::cmFindPathCommand()
+cmFindPathCommand::cmFindPathCommand(cmExecutionStatus& status)
+  : cmFindBase(status)
 {
   this->EnvironmentPath = "INCLUDE";
   this->IncludeFileInPath = false;
 }
 
 // cmFindPathCommand
-bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn,
-                                    cmExecutionStatus&)
+bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
 {
   this->VariableDocumentation = "Path to a file.";
   this->CMakePathName = "INCLUDE";
@@ -145,3 +145,9 @@ std::string cmFindPathCommand::FindFrameworkHeader()
   }
   return "";
 }
+
+bool cmFindPath(std::vector<std::string> const& args,
+                cmExecutionStatus& status)
+{
+  return cmFindPathCommand(status).InitialPass(args);
+}
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 89e2cef..8d1ea8b 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -8,9 +8,6 @@
 #include <string>
 #include <vector>
 
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
 #include "cmFindBase.h"
 
 class cmExecutionStatus;
@@ -25,21 +22,9 @@ class cmExecutionStatus;
 class cmFindPathCommand : public cmFindBase
 {
 public:
-  cmFindPathCommand();
-  /**
-   * This is a virtual constructor for the command.
-   */
-  std::unique_ptr<cmCommand> Clone() override
-  {
-    return cm::make_unique<cmFindPathCommand>();
-  }
-
-  /**
-   * This is called when the command is first encountered in
-   * the CMakeLists.txt file.
-   */
-  bool InitialPass(std::vector<std::string> const& args,
-                   cmExecutionStatus& status) override;
+  cmFindPathCommand(cmExecutionStatus& status);
+
+  bool InitialPass(std::vector<std::string> const& args);
 
   bool IncludeFileInPath;
 
@@ -51,4 +36,7 @@ private:
   std::string FindFrameworkHeader();
 };
 
+bool cmFindPath(std::vector<std::string> const& args,
+                cmExecutionStatus& status);
+
 #endif
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index a2db65c..e0a3fbf 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -88,14 +88,14 @@ struct cmFindProgramHelper
   }
 };
 
-cmFindProgramCommand::cmFindProgramCommand()
+cmFindProgramCommand::cmFindProgramCommand(cmExecutionStatus& status)
+  : cmFindBase(status)
 {
   this->NamesPerDirAllowed = true;
 }
 
 // cmFindProgramCommand
-bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn,
-                                       cmExecutionStatus&)
+bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
 {
   this->VariableDocumentation = "Path to a program.";
   this->CMakePathName = "PROGRAM";
@@ -270,3 +270,9 @@ std::string cmFindProgramCommand::GetBundleExecutable(
 
   return executable;
 }
+
+bool cmFindProgram(std::vector<std::string> const& args,
+                   cmExecutionStatus& status)
+{
+  return cmFindProgramCommand(status).InitialPass(args);
+}
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 40e455e..043b43c 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -8,9 +8,6 @@
 #include <string>
 #include <vector>
 
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
 #include "cmFindBase.h"
 
 class cmExecutionStatus;
@@ -26,21 +23,9 @@ class cmExecutionStatus;
 class cmFindProgramCommand : public cmFindBase
 {
 public:
-  cmFindProgramCommand();
-  /**
-   * This is a virtual constructor for the command.
-   */
-  std::unique_ptr<cmCommand> Clone() override
-  {
-    return cm::make_unique<cmFindProgramCommand>();
-  }
-
-  /**
-   * This is called when the command is first encountered in
-   * the CMakeLists.txt file.
-   */
-  bool InitialPass(std::vector<std::string> const& args,
-                   cmExecutionStatus& status) override;
+  cmFindProgramCommand(cmExecutionStatus& status);
+
+  bool InitialPass(std::vector<std::string> const& args);
 
 private:
   std::string FindProgram();
@@ -51,4 +36,7 @@ private:
   std::string GetBundleExecutable(std::string const& bundlePath);
 };
 
+bool cmFindProgram(std::vector<std::string> const& args,
+                   cmExecutionStatus& status);
+
 #endif

-----------------------------------------------------------------------

Summary of changes:
 .clang-tidy                                        |  3 +-
 Source/CPack/IFW/cmCPackIFWGenerator.cxx           | 28 +++++-------
 Source/CPack/IFW/cmCPackIFWPackage.cxx             |  6 +--
 Source/CPack/cmCPackGeneratorFactory.cxx           |  3 +-
 Source/CPack/cmCPackRPMGenerator.cxx               |  9 ++--
 Source/CTest/cmCTestCoverageHandler.cxx            | 13 +++---
 Source/CTest/cmCTestGenericHandler.cxx             |  9 ++--
 Source/CTest/cmCTestP4.cxx                         |  3 +-
 Source/CTest/cmCTestRunTest.cxx                    |  3 +-
 Source/CTest/cmCTestSVN.cxx                        |  2 +-
 Source/CTest/cmCTestTestHandler.cxx                | 27 ++++--------
 Source/CTest/cmParseCacheCoverage.cxx              |  3 +-
 Source/CTest/cmParseMumpsCoverage.cxx              |  3 +-
 Source/QtDialog/FirstConfigure.cxx                 |  3 +-
 Source/cmAddExecutableCommand.cxx                  |  2 +-
 Source/cmAddLibraryCommand.cxx                     |  2 +-
 Source/cmAlgorithms.h                              |  6 +--
 Source/cmCPluginAPI.cxx                            |  2 +-
 Source/cmCTest.cxx                                 |  3 +-
 Source/cmCacheManager.cxx                          |  6 +--
 Source/cmCommands.cxx                              | 13 +++---
 Source/cmCommonTargetGenerator.cxx                 |  6 +--
 Source/cmComputeLinkDepends.cxx                    | 11 ++---
 Source/cmComputeLinkInformation.cxx                |  3 +-
 Source/cmComputeTargetDepends.cxx                  |  8 ++--
 Source/cmConditionEvaluator.cxx                    | 12 ++---
 Source/cmCreateTestSourceList.cxx                  |  4 +-
 Source/cmDepends.cxx                               |  3 +-
 Source/cmDependsC.cxx                              |  3 +-
 Source/cmDependsFortran.cxx                        | 12 ++---
 Source/cmDynamicLoader.cxx                         |  6 +--
 Source/cmELF.cxx                                   |  6 +--
 Source/cmExportFileGenerator.cxx                   |  2 +-
 Source/cmExportSetMap.cxx                          |  2 +-
 Source/cmExtraCodeBlocksGenerator.cxx              |  3 +-
 Source/cmExtraCodeLiteGenerator.cxx                |  2 +-
 Source/cmExtraEclipseCDT4Generator.cxx             |  4 +-
 Source/cmExtraSublimeTextGenerator.cxx             |  2 +-
 Source/cmFileAPICodemodel.cxx                      |  3 +-
 Source/cmFileCommand.cxx                           |  8 ++--
 Source/cmFindBase.cxx                              |  5 ++-
 Source/cmFindBase.h                                |  6 ++-
 Source/cmFindCommon.cxx                            | 10 ++++-
 Source/cmFindCommon.h                              | 14 ++++--
 Source/cmFindFileCommand.cxx                       | 11 ++++-
 Source/cmFindFileCommand.h                         | 18 ++++----
 Source/cmFindLibraryCommand.cxx                    | 12 +++--
 Source/cmFindLibraryCommand.h                      | 24 +++-------
 Source/cmFindPackageCommand.cxx                    | 22 ++++++----
 Source/cmFindPackageCommand.h                      | 27 +++---------
 Source/cmFindPathCommand.cxx                       | 12 +++--
 Source/cmFindPathCommand.h                         | 24 +++-------
 Source/cmFindProgramCommand.cxx                    | 12 +++--
 Source/cmFindProgramCommand.h                      | 24 +++-------
 Source/cmFunctionCommand.cxx                       |  3 +-
 Source/cmGeneratorExpression.cxx                   |  4 +-
 Source/cmGeneratorExpressionDAGChecker.cxx         |  3 +-
 Source/cmGeneratorExpressionEvaluationFile.cxx     |  3 +-
 Source/cmGeneratorExpressionEvaluator.cxx          | 11 ++---
 Source/cmGeneratorExpressionParser.cxx             | 13 ++----
 Source/cmGeneratorTarget.cxx                       | 47 ++++++++------------
 Source/cmGetDirectoryPropertyCommand.cxx           |  2 +-
 Source/cmGhsMultiTargetGenerator.cxx               |  9 ++--
 Source/cmGlobalUnixMakefileGenerator3.cxx          |  3 +-
 Source/cmGlobalXCodeGenerator.cxx                  | 21 +++------
 Source/cmGraphVizWriter.cxx                        | 18 +++-----
 Source/cmIncludeDirectoryCommand.cxx               |  2 +-
 Source/cmInstallFilesCommand.cxx                   |  4 +-
 Source/cmInstallProgramsCommand.cxx                |  4 +-
 Source/cmInstallTargetsCommand.cxx                 |  4 +-
 Source/cmInstalledFile.cxx                         |  2 +-
 Source/cmLinkLibrariesCommand.cxx                  |  3 +-
 Source/cmListCommand.cxx                           | 32 ++++++--------
 Source/cmLocalGenerator.cxx                        | 15 +++----
 Source/cmLocalNinjaGenerator.cxx                   |  8 ++--
 Source/cmLocalUnixMakefileGenerator3.cxx           | 13 +++---
 Source/cmMacroCommand.cxx                          |  3 +-
 Source/cmMakefile.cxx                              | 43 ++++++++----------
 Source/cmMakefileLibraryTargetGenerator.cxx        |  2 +-
 Source/cmOrderDirectories.cxx                      | 14 +++---
 Source/cmOutputRequiredFilesCommand.cxx            |  5 +--
 Source/cmParseArgumentsCommand.cxx                 |  4 +-
 Source/cmPropertyDefinitionMap.cxx                 |  4 +-
 Source/cmQtAutoGen.cxx                             | 10 ++---
 Source/cmQtAutoMocUic.cxx                          |  2 +-
 Source/cmRST.cxx                                   | 11 +++--
 Source/cmRulePlaceholderExpander.cxx               |  6 +--
 Source/cmSetPropertyCommand.cxx                    |  3 +-
 Source/cmSourceGroupCommand.cxx                    |  3 +-
 Source/cmState.cxx                                 | 10 ++---
 Source/cmStateDirectory.cxx                        | 51 ++++++++--------------
 Source/cmStateSnapshot.cxx                         | 18 +++-----
 Source/cmSystemTools.cxx                           |  7 ++-
 Source/cmTarget.cxx                                | 45 ++++++++-----------
 Source/cmUVStreambuf.h                             |  2 +-
 Source/cmUtilitySourceCommand.cxx                  |  2 +-
 Source/cmVariableWatch.cxx                         |  3 +-
 Source/cmWriteFileCommand.cxx                      |  2 +-
 Source/cmXCodeObject.h                             |  3 +-
 Source/cmake.cxx                                   | 13 +++---
 Source/cmcmd.cxx                                   |  2 +-
 Tests/CMakeLib/run_compile_commands.cxx            |  2 +-
 .../WiX/CustomAction/detect_nsis_overwrite.cpp     |  3 +-
 103 files changed, 403 insertions(+), 564 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list