From efed6468eda950644014ccfada85300710e05009 Mon Sep 17 00:00:00 2001
From: Daniel Pfeifer <daniel@pfeifer-mail.de>
Date: Thu, 1 Sep 2016 20:59:28 +0200
Subject: fix a load of include-what-you-use violations

---
 Source/QtDialog/CMakeSetup.cxx                 |  2 +
 Source/cmCTest.cxx                             | 56 +++++++++++-----------
 Source/cmCTest.h                               | 16 +++----
 Source/cmCommandArgumentParserHelper.cxx       | 10 +++-
 Source/cmCommandArgumentParserHelper.h         |  5 +-
 Source/cmConditionEvaluator.cxx                |  1 +
 Source/cmCryptoHash.cxx                        |  2 +
 Source/cmCryptoHash.h                          |  4 +-
 Source/cmCurl.cxx                              |  9 +++-
 Source/cmCurl.h                                |  5 +-
 Source/cmCustomCommand.cxx                     |  2 +-
 Source/cmCustomCommand.h                       | 10 ++--
 Source/cmCustomCommandGenerator.cxx            |  7 +++
 Source/cmCustomCommandGenerator.h              |  7 +--
 Source/cmDefinitions.cxx                       |  2 +
 Source/cmDefinitions.h                         |  9 ++--
 Source/cmDepends.cxx                           |  3 ++
 Source/cmDepends.h                             |  7 ++-
 Source/cmDependsC.cxx                          |  5 +-
 Source/cmDependsC.h                            |  9 ++++
 Source/cmDependsFortran.cxx                    |  8 +++-
 Source/cmDependsFortran.h                      |  7 +++
 Source/cmDependsJava.cxx                       |  1 -
 Source/cmDependsJava.h                         |  7 +++
 Source/cmDependsJavaParserHelper.cxx           |  7 +++
 Source/cmDependsJavaParserHelper.h             |  5 +-
 Source/cmDocumentation.cxx                     |  9 ++--
 Source/cmDocumentation.h                       | 14 +++---
 Source/cmDocumentationFormatter.cxx            |  6 +++
 Source/cmDocumentationFormatter.h              |  4 +-
 Source/cmDocumentationSection.h                |  7 ++-
 Source/cmDynamicLoader.cxx                     |  7 +++
 Source/cmDynamicLoader.h                       |  4 +-
 Source/cmELF.cxx                               |  8 +++-
 Source/cmELF.h                                 |  5 ++
 Source/cmExportBuildFileGenerator.cxx          | 14 ++++++
 Source/cmExportBuildFileGenerator.h            | 10 +++-
 Source/cmExportFileGenerator.cxx               | 13 +++--
 Source/cmExportFileGenerator.h                 | 14 ++++--
 Source/cmExportInstallFileGenerator.cxx        | 10 ++++
 Source/cmExportInstallFileGenerator.h          | 10 ++++
 Source/cmExportSet.h                           |  7 ++-
 Source/cmExportSetMap.cxx                      |  2 +
 Source/cmExportSetMap.h                        |  5 +-
 Source/cmExportTryCompileFileGenerator.cxx     | 11 ++++-
 Source/cmExportTryCompileFileGenerator.h       | 12 ++++-
 Source/cmExprParserHelper.cxx                  |  6 ++-
 Source/cmExprParserHelper.h                    |  8 ++--
 Source/cmExternalMakefileProjectGenerator.cxx  |  2 +-
 Source/cmExternalMakefileProjectGenerator.h    |  8 ++--
 Source/cmExtraCodeBlocksGenerator.cxx          | 13 +++--
 Source/cmExtraCodeBlocksGenerator.h            |  7 ++-
 Source/cmExtraCodeLiteGenerator.cxx            | 16 ++++---
 Source/cmExtraCodeLiteGenerator.h              |  6 +++
 Source/cmExtraEclipseCDT4Generator.cxx         | 19 ++++++--
 Source/cmExtraEclipseCDT4Generator.h           | 10 +++-
 Source/cmExtraKateGenerator.cxx                | 12 +++--
 Source/cmExtraKateGenerator.h                  |  6 ++-
 Source/cmExtraSublimeTextGenerator.cxx         | 11 +++--
 Source/cmExtraSublimeTextGenerator.h           | 12 +++--
 Source/cmFileLock.h                            |  4 +-
 Source/cmFileLockPool.h                        |  7 ++-
 Source/cmFileLockResult.cxx                    |  1 +
 Source/cmFileLockResult.h                      |  4 +-
 Source/cmFilePathUuid.cxx                      |  2 +
 Source/cmFilePathUuid.h                        |  5 +-
 Source/cmFileTimeComparison.cxx                | 13 +++--
 Source/cmFileTimeComparison.h                  |  4 +-
 Source/cmFortranParserImpl.cxx                 |  9 +++-
 Source/cmGeneratedFileStream.cxx               |  2 +
 Source/cmGeneratedFileStream.h                 |  3 +-
 Source/cmGeneratorExpression.cxx               |  8 ++--
 Source/cmGeneratorExpression.h                 | 14 +++---
 Source/cmGeneratorExpressionContext.cxx        |  2 -
 Source/cmGeneratorExpressionDAGChecker.cxx     |  8 ++++
 Source/cmGeneratorExpressionDAGChecker.h       |  9 +++-
 Source/cmGeneratorExpressionEvaluationFile.cxx |  9 +++-
 Source/cmGeneratorExpressionEvaluationFile.h   |  5 ++
 Source/cmGeneratorExpressionEvaluator.cxx      | 17 ++-----
 Source/cmGeneratorExpressionEvaluator.h        |  6 +--
 Source/cmGeneratorExpressionLexer.h            |  6 +--
 Source/cmGeneratorExpressionNode.cxx           | 36 ++++++++++++--
 Source/cmGeneratorExpressionNode.h             | 20 ++++----
 Source/cmGeneratorExpressionParser.cxx         |  3 +-
 Source/cmGeneratorExpressionParser.h           |  5 +-
 Source/cmGeneratorTarget.cxx                   | 20 ++++++--
 Source/cmGeneratorTarget.h                     | 13 ++++-
 Source/cmGhsMultiTargetGenerator.cxx           |  1 +
 Source/cmGlobalCommonGenerator.cxx             |  2 +
 Source/cmGlobalCommonGenerator.h               |  4 ++
 Source/cmGlobalGenerator.cxx                   | 20 +++++---
 Source/cmGlobalGenerator.h                     | 32 +++++++------
 Source/cmGlobalGhsMultiGenerator.cxx           |  1 +
 Source/cmGlobalKdevelopGenerator.cxx           | 12 +++--
 Source/cmGlobalKdevelopGenerator.h             |  5 ++
 Source/cmGlobalNinjaGenerator.cxx              | 13 ++++-
 Source/cmGlobalNinjaGenerator.h                | 22 +++++++--
 Source/cmGlobalUnixMakefileGenerator3.cxx      | 12 +++++
 Source/cmGlobalUnixMakefileGenerator3.h        | 18 ++++++-
 Source/cmGlobalVisualStudio10Generator.cxx     |  1 +
 Source/cmGlobalVisualStudio71Generator.cxx     |  1 +
 Source/cmGlobalVisualStudio7Generator.cxx      |  1 +
 Source/cmGlobalVisualStudio8Generator.cxx      |  1 +
 Source/cmGlobalWatcomWMakeGenerator.cxx        |  4 +-
 Source/cmGlobalWatcomWMakeGenerator.h          | 10 ++++
 Source/cmGraphVizWriter.cxx                    | 10 ++++
 Source/cmGraphVizWriter.h                      | 12 +++--
 Source/cmInstallDirectoryGenerator.cxx         |  3 ++
 Source/cmInstallDirectoryGenerator.h           |  8 ++++
 Source/cmInstallExportGenerator.cxx            | 18 ++++---
 Source/cmInstallExportGenerator.h              | 12 +++--
 Source/cmInstallFilesGenerator.cxx             |  6 ++-
 Source/cmInstallFilesGenerator.h               |  9 ++++
 Source/cmInstallGenerator.cxx                  |  2 +
 Source/cmInstallGenerator.h                    |  6 +++
 Source/cmInstallScriptGenerator.cxx            |  5 ++
 Source/cmInstallScriptGenerator.h              |  5 ++
 Source/cmInstallTargetGenerator.cxx            | 10 +++-
 Source/cmInstallTargetGenerator.h              |  8 ++++
 Source/cmInstalledFile.cxx                     |  4 ++
 Source/cmInstalledFile.h                       |  7 +++
 Source/cmListFileCache.cxx                     |  7 ++-
 Source/cmListFileCache.h                       |  7 ++-
 Source/cmLocalCommonGenerator.cxx              |  5 ++
 Source/cmLocalCommonGenerator.h                |  9 +++-
 Source/cmLocalGenerator.cxx                    | 14 ++++--
 Source/cmLocalGenerator.h                      | 20 +++++---
 Source/cmLocalNinjaGenerator.cxx               |  9 ++++
 Source/cmLocalNinjaGenerator.h                 | 18 ++++++-
 Source/cmLocalUnixMakefileGenerator3.cxx       | 16 +++++--
 Source/cmLocalUnixMakefileGenerator3.h         | 15 ++++--
 Source/cmLocalVisualStudio10Generator.cxx      |  2 +
 Source/cmLocalVisualStudioGenerator.cxx        |  1 +
 Source/cmLocalXCodeGenerator.cxx               |  1 +
 Source/cmMakefile.cxx                          | 13 ++---
 Source/cmMakefile.h                            |  4 ++
 Source/cmMessenger.cxx                         |  8 +++-
 Source/cmMessenger.h                           |  7 ++-
 Source/cmOSXBundleGenerator.cxx                |  6 +++
 Source/cmOSXBundleGenerator.h                  | 13 ++---
 Source/cmOrderDirectories.cxx                  |  6 ++-
 Source/cmOrderDirectories.h                    | 10 ++--
 Source/cmOutputConverter.cxx                   |  8 ++--
 Source/cmOutputConverter.h                     |  8 ++--
 Source/cmQtAutoGeneratorInitializer.cxx        | 29 +++++++++--
 Source/cmQtAutoGeneratorInitializer.h          |  9 +---
 Source/cmQtAutoGenerators.cxx                  | 13 +++--
 Source/cmQtAutoGenerators.h                    |  5 +-
 Source/cmRST.cxx                               |  5 ++
 Source/cmRST.h                                 |  9 ++--
 Source/cmScriptGenerator.cxx                   |  2 +
 Source/cmScriptGenerator.h                     |  6 ++-
 Source/cmSourceFile.cxx                        |  5 ++
 Source/cmSourceFile.h                          | 10 ++--
 Source/cmSourceFileLocation.cxx                |  7 ++-
 Source/cmSourceFileLocation.h                  |  4 +-
 Source/cmSourceGroup.h                         |  6 +--
 Source/cmSystemTools.cxx                       | 66 ++++++++++++++------------
 Source/cmTestGenerator.cxx                     |  1 +
 Source/cmake.cxx                               | 41 ++++++++++------
 Source/cmake.h                                 | 20 ++++----
 Source/cmakemain.cxx                           | 13 +++--
 Source/cmcmd.cxx                               | 26 ++++++----
 Source/cmcmd.h                                 |  5 +-
 Source/ctest.cxx                               | 17 ++++---
 165 files changed, 1102 insertions(+), 438 deletions(-)

diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index ee3389c..5a8a5be 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -27,6 +27,8 @@
 #include <cmsys/Encoding.hxx>
 #include <cmsys/SystemTools.hxx>
 
+#include "cmSystemTools.h" // IWYU pragma: keep
+
 static const char* cmDocumentationName[][2] = { { 0,
                                                   "  cmake-gui - CMake GUI." },
                                                 { 0, 0 } };
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index b4ddc3e..6523e3e 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -9,52 +9,54 @@
   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   See the License for more information.
 ============================================================================*/
-#include "cmCurl.h" // include before anything that includes windows.h
-
 #include "cmCTest.h"
 
 #include "cmAlgorithms.h"
-#include "cmCTestCommand.h"
-#include "cmCTestStartCommand.h"
-#include "cmDynamicLoader.h"
-#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
-#include "cmState.h"
-#include "cmVersionMacros.h"
-#include "cmXMLWriter.h"
-#include "cmake.h"
-#include <cmsys/Base64.h>
-#include <cmsys/Directory.hxx>
-#include <cmsys/FStream.hxx>
-#include <cmsys/SystemInformation.hxx>
-
 #include "cmCTestBuildAndTestHandler.h"
 #include "cmCTestBuildHandler.h"
 #include "cmCTestConfigureHandler.h"
 #include "cmCTestCoverageHandler.h"
+#include "cmCTestGenericHandler.h"
 #include "cmCTestMemCheckHandler.h"
 #include "cmCTestScriptHandler.h"
+#include "cmCTestStartCommand.h"
 #include "cmCTestSubmitHandler.h"
 #include "cmCTestTestHandler.h"
 #include "cmCTestUpdateHandler.h"
 #include "cmCTestUploadHandler.h"
-
+#include "cmCurl.h"
+#include "cmDynamicLoader.h"
+#include "cmGeneratedFileStream.h"
+#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
 #include "cmVersion.h"
+#include "cmVersionConfig.h"
+#include "cmXMLWriter.h"
+#include "cmake.h"
 
+#include <cm_auto_ptr.hxx>
+#include <cm_curl.h>
+#include <cm_zlib.h>
+#include <cmsys/Base64.h>
+#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
 #include <cmsys/Glob.hxx>
 #include <cmsys/Process.h>
-#include <cmsys/RegularExpression.hxx>
-
+#include <cmsys/String.hxx>
+#include <cmsys/SystemInformation.hxx>
 #include <ctype.h>
-#include <float.h>
-#include <math.h>
+#include <iostream>
+#include <map>
+#include <sstream>
+#include <stdio.h>
 #include <stdlib.h>
-
-#include <cm_auto_ptr.hxx>
-
-#include <cm_zlib.h>
-#include <cmsys/Base64.h>
+#include <string.h>
+#include <string>
+#include <time.h>
+#include <utility>
+#include <vector>
 
 #if defined(__BEOS__) || defined(__HAIKU__)
 #include <be/kernel/OS.h> /* disable_debugger() API. */
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 9d661d4..a73cd83 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -15,18 +15,18 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
-#include "cmListFileCache.h"
+#include <cmsys/String.hxx>
+#include <map>
+#include <set>
+#include <sstream>
+#include <string>
 #include <time.h>
+#include <vector>
 
-class cmake;
-class cmMakefile;
 class cmCTestGenericHandler;
-class cmGeneratedFileStream;
-class cmCTestCommand;
-class cmCTestScriptHandler;
 class cmCTestStartCommand;
+class cmGeneratedFileStream;
+class cmMakefile;
 class cmXMLWriter;
 
 #define cmCTestLog(ctSelf, logType, msg)                                      \
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 68111a0..6a2dfe8 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -11,12 +11,18 @@
 ============================================================================*/
 #include "cmCommandArgumentParserHelper.h"
 
+#include <cm_kwiml.h>
+
+#include "cmCommandArgumentLexer.h"
 #include "cmMakefile.h"
-#include "cmOutputConverter.h"
 #include "cmState.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
 
-#include "cmCommandArgumentLexer.h"
+#include <cmConfigure.h>
+#include <iostream>
+#include <sstream>
+#include <string.h>
 
 int cmCommandArgument_yyparse(yyscan_t yyscanner);
 //
diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h
index 1040ad3..6faf12b 100644
--- a/Source/cmCommandArgumentParserHelper.h
+++ b/Source/cmCommandArgumentParserHelper.h
@@ -12,9 +12,10 @@
 #ifndef cmCommandArgumentParserHelper_h
 #define cmCommandArgumentParserHelper_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <string>
+#include <vector>
 
 #define YYSTYPE cmCommandArgumentParserHelper::ParserType
 #define YYSTYPE_IS_DECLARED
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index d7532b3..94f03e8 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -14,6 +14,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmOutputConverter.h"
+#include "cmSystemTools.h"
 
 static std::string const keyAND = "AND";
 static std::string const keyCOMMAND = "COMMAND";
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index 8e2d87e..a3d3dd5 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -12,8 +12,10 @@
 #include "cmCryptoHash.h"
 
 #include "cm_sha2.h"
+
 #include <cmsys/FStream.hxx>
 #include <cmsys/MD5.h>
+#include <string.h>
 
 CM_AUTO_PTR<cmCryptoHash> cmCryptoHash::New(const char* algo)
 {
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index c51393d..0be2918 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -14,9 +14,9 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
 #include <cm_auto_ptr.hxx>
+#include <string>
+#include <vector>
 
 /**
  * @brief Abstract base class for cryptographic hash generators
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
index 5bc4f91..eec773f 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -11,7 +11,13 @@
 ============================================================================*/
 #include "cmCurl.h"
 
+#include "cmThirdParty.h"
+
+#if !defined(CMAKE_USE_SYSTEM_CURL) && !defined(_WIN32) &&                    \
+  !defined(__APPLE__) && !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH)
+#define CMAKE_FIND_CAFILE
 #include "cmSystemTools.h"
+#endif
 
 // curl versions before 7.21.5 did not provide this error code
 #if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM < 0x071505
@@ -32,8 +38,7 @@ std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile)
     ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile);
     check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
   }
-#if !defined(CMAKE_USE_SYSTEM_CURL) && !defined(_WIN32) &&                    \
-  !defined(__APPLE__) && !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH)
+#ifdef CMAKE_FIND_CAFILE
 #define CMAKE_CAFILE_FEDORA "/etc/pki/tls/certs/ca-bundle.crt"
   else if (cmSystemTools::FileExists(CMAKE_CAFILE_FEDORA, true)) {
     ::CURLcode res =
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index c3a2053..6434f50 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -14,9 +14,8 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
-#include "cm_curl.h"
+#include <cm_curl.h>
+#include <string>
 
 std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = CM_NULLPTR);
 
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index eaa49b0..89a04d1 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -13,7 +13,7 @@
 
 #include "cmMakefile.h"
 
-#include <cm_auto_ptr.hxx>
+#include <cmConfigure.h>
 
 cmCustomCommand::cmCustomCommand()
   : Backtrace()
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index 152b3b9..b855bb9 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -12,11 +12,15 @@
 #ifndef cmCustomCommand_h
 #define cmCustomCommand_h
 
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
+#include "cmCustomCommandLines.h"
 #include "cmListFileCache.h"
+
+#include <string>
+#include <utility>
+#include <vector>
+
 class cmMakefile;
 
 /** \class cmCustomCommand
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 6165bcf..8b8579b 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -12,10 +12,17 @@
 #include "cmCustomCommandGenerator.h"
 
 #include "cmCustomCommand.h"
+#include "cmCustomCommandLines.h"
 #include "cmGeneratorExpression.h"
+#include "cmGeneratorTarget.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmOutputConverter.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
+
+#include <cmConfigure.h>
 
 cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
                                                    const std::string& config,
diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h
index 66644d6..f4cd9fd 100644
--- a/Source/cmCustomCommandGenerator.h
+++ b/Source/cmCustomCommandGenerator.h
@@ -12,13 +12,14 @@
 #ifndef cmCustomCommandGenerator_h
 #define cmCustomCommandGenerator_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <string>
+#include <vector>
 
 class cmCustomCommand;
-class cmLocalGenerator;
 class cmGeneratorExpression;
+class cmLocalGenerator;
 
 class cmCustomCommandGenerator
 {
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index e0fb59b..fecc488 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -12,6 +12,8 @@
 #include "cmDefinitions.h"
 
 #include <assert.h>
+#include <set>
+#include <utility>
 
 cmDefinitions::Def cmDefinitions::NoDef;
 
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index f22de79..d1423ec 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -14,20 +14,21 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
 #include "cmLinkedTree.h"
 
+#include <string>
+#include <vector>
+
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #ifdef CMake_HAVE_CXX_UNORDERED_MAP
 #include <unordered_map>
 #else
 #include "cmsys/hash_map.hxx"
 #endif
+#else
+#include <map>
 #endif
 
-#include <list>
-
 /** \class cmDefinitions
  * \brief Store a scope of variable definitions for CMake language.
  *
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index ce72eda..23ff3a4 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -16,8 +16,11 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSystemTools.h"
+
 #include <cmsys/FStream.hxx>
+#include <sstream>
 #include <string.h>
+#include <utility>
 
 cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir)
   : CompileDirectory()
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index b9d47a6..5ed784d 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -14,7 +14,12 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <stddef.h>
+#include <string>
+#include <vector>
 
 class cmFileTimeComparison;
 class cmLocalGenerator;
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 928f7ec..fbbf42f 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -15,10 +15,11 @@
 #include "cmFileTimeComparison.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmOutputConverter.h"
 #include "cmSystemTools.h"
-#include <cmsys/FStream.hxx>
 
-#include <ctype.h> // isspace
+#include <cmsys/FStream.hxx>
+#include <utility>
 
 #define INCLUDE_REGEX_LINE                                                    \
   "^[ \t]*#[ \t]*(include|import)[ \t]*[<\"]([^\">]+)([\">])"
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index bde07b7..5606fb3 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -12,10 +12,19 @@
 #ifndef cmDependsC_h
 #define cmDependsC_h
 
+#include <cmConfigure.h>
+
 #include "cmDepends.h"
 
 #include <cmsys/RegularExpression.hxx>
+#include <iosfwd>
+#include <map>
 #include <queue>
+#include <set>
+#include <string>
+#include <vector>
+
+class cmLocalGenerator;
 
 /** \class cmDependsC
  * \brief Dependency scanner for C and C++ object files.
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 8c0acce..1eece98 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -11,14 +11,20 @@
 ============================================================================*/
 #include "cmDependsFortran.h"
 
+#include "cmFortranParser.h" /* Interface to parser object.  */
 #include "cmGeneratedFileStream.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmOutputConverter.h"
 #include "cmSystemTools.h"
 
-#include "cmFortranParser.h" /* Interface to parser object.  */
 #include <assert.h>
 #include <cmsys/FStream.hxx>
+#include <iostream>
+#include <map>
+#include <stdlib.h>
+#include <string.h>
+#include <utility>
 
 // TODO: Test compiler for the case of the mod file.  Some always
 // use lower case and some always use upper case.  I do not know if any
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index f4385eb..b6de46f 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -12,10 +12,17 @@
 #ifndef cmFortran_h
 #define cmFortran_h
 
+#include <cmConfigure.h>
+#include <iosfwd>
+#include <set>
+#include <string>
+#include <vector>
+
 #include "cmDepends.h"
 
 class cmDependsFortranInternals;
 class cmFortranSourceInfo;
+class cmLocalGenerator;
 
 /** \class cmDependsFortran
  * \brief Dependency scanner for Fortran object files.
diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx
index a9130e6..18bc695 100644
--- a/Source/cmDependsJava.cxx
+++ b/Source/cmDependsJava.cxx
@@ -11,7 +11,6 @@
 ============================================================================*/
 #include "cmDependsJava.h"
 
-#include "cmDependsJavaParserHelper.h"
 #include "cmSystemTools.h"
 
 cmDependsJava::cmDependsJava()
diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h
index 5bb3039..95265c5 100644
--- a/Source/cmDependsJava.h
+++ b/Source/cmDependsJava.h
@@ -12,8 +12,15 @@
 #ifndef cmDependsJava_h
 #define cmDependsJava_h
 
+#include <cmConfigure.h>
+
 #include "cmDepends.h"
 
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+
 /** \class cmDependsJava
  * \brief Dependency scanner for Java class files.
  */
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index 79c4669..8d77ca6 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -11,9 +11,16 @@
 ============================================================================*/
 #include "cmDependsJavaParserHelper.h"
 
+#include <cmConfigure.h>
+
 #include "cmDependsJavaLexer.h"
 #include "cmSystemTools.h"
+
 #include <cmsys/FStream.hxx>
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 int cmDependsJava_yyparse(yyscan_t yyscanner);
 
diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h
index 377d584..731bbcc 100644
--- a/Source/cmDependsJavaParserHelper.h
+++ b/Source/cmDependsJavaParserHelper.h
@@ -12,9 +12,10 @@
 #ifndef cmDependsJavaParserHelper_h
 #define cmDependsJavaParserHelper_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <string>
+#include <vector>
 
 #define YYSTYPE cmDependsJavaParserHelper::ParserType
 #define YYSTYPE_IS_DECLARED
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 5516cf1..13736b9 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -12,17 +12,18 @@
 #include "cmDocumentation.h"
 
 #include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
+#include "cmDocumentationSection.h"
 #include "cmRST.h"
 #include "cmSystemTools.h"
 #include "cmVersion.h"
 
-#include <cmsys/Directory.hxx>
+#include <algorithm>
 #include <cmsys/FStream.hxx>
 #include <cmsys/Glob.hxx>
-
 #include <ctype.h>
-
-#include <algorithm>
+#include <string.h>
+#include <utility>
 
 static const char* cmDocumentationStandardOptions[][2] = {
   { "--help,-help,-usage,-h,-H,/?", "Print usage information and exit." },
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index c82e1d4..7661eb7 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -14,15 +14,15 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
 #include "cmDocumentationFormatter.h"
-#include "cmDocumentationSection.h"
-#include "cmake.h"
 
-namespace cmsys {
-class Directory;
-}
+#include <iosfwd>
+#include <map>
+#include <string>
+#include <vector>
+
+class cmDocumentationSection;
+struct cmDocumentationEntry;
 
 /** Class to generate documentation.  */
 class cmDocumentation : public cmDocumentationEnums
diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx
index 4816bb9..5a718a2 100644
--- a/Source/cmDocumentationFormatter.cxx
+++ b/Source/cmDocumentationFormatter.cxx
@@ -11,8 +11,14 @@
 ============================================================================*/
 #include "cmDocumentationFormatter.h"
 
+#include "cmDocumentationEntry.h"
 #include "cmDocumentationSection.h"
 
+#include <ostream>
+#include <string.h>
+#include <string>
+#include <vector>
+
 cmDocumentationFormatter::cmDocumentationFormatter()
   : TextWidth(77)
   , TextIndent("")
diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h
index 7a93120..09fb20b 100644
--- a/Source/cmDocumentationFormatter.h
+++ b/Source/cmDocumentationFormatter.h
@@ -12,9 +12,9 @@
 #ifndef _cmDocumentationFormatter_h
 #define _cmDocumentationFormatter_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <iosfwd>
 
 /** This is just a helper class to make it build with MSVC 6.0.
 Actually the enums and internal classes could directly go into
diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h
index 161a731..1d41070 100644
--- a/Source/cmDocumentationSection.h
+++ b/Source/cmDocumentationSection.h
@@ -12,7 +12,12 @@
 #ifndef _cmDocumentationSection_h
 #define _cmDocumentationSection_h
 
-#include "cmDocumentationFormatter.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include "cmDocumentationEntry.h"
+
+#include <string>
+#include <vector>
 
 // Low-level interface for custom documents:
 /** Internal class representing a section of the documentation.
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index f6841ad..762feee 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -11,6 +11,13 @@
 ============================================================================*/
 #include "cmDynamicLoader.h"
 
+#include <cmConfigure.h>
+
+#include <cmsys/DynamicLoader.hxx>
+#include <map>
+#include <string>
+#include <utility>
+
 class cmDynamicLoaderCache
 {
 public:
diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h
index d9b8990..4f6ade5 100644
--- a/Source/cmDynamicLoader.h
+++ b/Source/cmDynamicLoader.h
@@ -17,9 +17,7 @@
 #ifndef cmDynamicLoader_h
 #define cmDynamicLoader_h
 
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
 #include <cmsys/DynamicLoader.hxx>
 
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 150593b..6fff984 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -9,12 +9,16 @@
   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   See the License for more information.
 ============================================================================*/
-#include "cmStandardIncludes.h" // to get CMAKE_USE_ELF_PARSER first
-
 #include "cmELF.h"
 
 #include <cm_auto_ptr.hxx>
+#include <cm_kwiml.h>
 #include <cmsys/FStream.hxx>
+#include <map>
+#include <sstream>
+#include <stddef.h>
+#include <utility>
+#include <vector>
 
 // Include the ELF format information system header.
 #if defined(__OpenBSD__)
diff --git a/Source/cmELF.h b/Source/cmELF.h
index 80832ad..a4c3456 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -12,6 +12,11 @@
 #ifndef cmELF_h
 #define cmELF_h
 
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <string>
+
 #if !defined(CMAKE_USE_ELF_PARSER)
 #error "This file may be included only if CMAKE_USE_ELF_PARSER is enabled."
 #endif
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 390477a..8f4dfd8 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -12,9 +12,23 @@
 #include "cmExportBuildFileGenerator.h"
 
 #include "cmExportSet.h"
+#include "cmGeneratorExpression.h"
+#include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmTargetExport.h"
+#include "cmake.h"
+
+#include <algorithm>
+#include <map>
+#include <set>
+#include <sstream>
+#include <utility>
 
 cmExportBuildFileGenerator::cmExportBuildFileGenerator()
 {
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index 417e8c9..990824f 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -12,10 +12,18 @@
 #ifndef cmExportBuildFileGenerator_h
 #define cmExportBuildFileGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmExportFileGenerator.h"
-#include "cmListFileCache.h"
+
+#include <iosfwd>
+#include <string>
+#include <vector>
 
 class cmExportSet;
+class cmGeneratorTarget;
+class cmGlobalGenerator;
+class cmLocalGenerator;
 
 /** \class cmExportBuildFileGenerator
  * \brief Generate a file exporting targets from a build tree.
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 7f01196..23c77d9 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -13,20 +13,25 @@
 
 #include "cmAlgorithms.h"
 #include "cmComputeLinkInformation.h"
-#include "cmExportSet.h"
 #include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmInstallExportGenerator.h"
+#include "cmGeneratorTarget.h"
+#include "cmLinkItem.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmOutputConverter.h"
+#include "cmPolicies.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmTargetExport.h"
-#include "cmVersion.h"
+#include "cmake.h"
 
 #include <assert.h>
 #include <cm_auto_ptr.hxx>
 #include <cmsys/FStream.hxx>
+#include <sstream>
+#include <string.h>
+#include <utility>
 
 static std::string cmExportFileGeneratorEscape(std::string const& str)
 {
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 9c96015..354994a 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -12,11 +12,19 @@
 #ifndef cmExportFileGenerator_h
 #define cmExportFileGenerator_h
 
-#include "cmCommand.h"
-#include "cmGeneratorExpression.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
+#include "cmGeneratorExpression.h"
 #include "cmVersion.h"
-#include "cmVersionMacros.h"
+#include "cmVersionConfig.h"
+
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+class cmGeneratorTarget;
 
 #define STRINGIFY_HELPER(X) #X
 #define STRINGIFY(X) STRINGIFY_HELPER(X)
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 7747157..ceba69a 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -15,12 +15,22 @@
 #include "cmExportSet.h"
 #include "cmExportSetMap.h"
 #include "cmGeneratedFileStream.h"
+#include "cmGeneratorExpression.h"
+#include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmInstallExportGenerator.h"
 #include "cmInstallTargetGenerator.h"
 #include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmTargetExport.h"
 
+#include <sstream>
+#include <utility>
+
 cmExportInstallFileGenerator::cmExportInstallFileGenerator(
   cmInstallExportGenerator* iegen)
   : IEGen(iegen)
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 68960db..c693dc1 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -12,8 +12,18 @@
 #ifndef cmExportInstallFileGenerator_h
 #define cmExportInstallFileGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmExportFileGenerator.h"
 
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+class cmGeneratorTarget;
+class cmGlobalGenerator;
 class cmInstallExportGenerator;
 class cmInstallTargetGenerator;
 
diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h
index 49f2cac..4f3c9d8 100644
--- a/Source/cmExportSet.h
+++ b/Source/cmExportSet.h
@@ -12,11 +12,14 @@
 #ifndef cmExportSet_h
 #define cmExportSet_h
 
-#include "cmSystemTools.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
 
-class cmTargetExport;
 class cmInstallExportGenerator;
 class cmLocalGenerator;
+class cmTargetExport;
 
 /// A set of targets that were installed with the same EXPORT parameter.
 class cmExportSet
diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx
index ac1c66e..42fb781 100644
--- a/Source/cmExportSetMap.cxx
+++ b/Source/cmExportSetMap.cxx
@@ -15,6 +15,8 @@
 #include "cmAlgorithms.h"
 #include "cmExportSet.h"
 
+#include <utility>
+
 cmExportSet* cmExportSetMap::operator[](const std::string& name)
 {
   std::map<std::string, cmExportSet*>::iterator it = this->find(name);
diff --git a/Source/cmExportSetMap.h b/Source/cmExportSetMap.h
index d2954e3..c3a55ba 100644
--- a/Source/cmExportSetMap.h
+++ b/Source/cmExportSetMap.h
@@ -12,7 +12,10 @@
 #ifndef cmExportSetMap_h
 #define cmExportSetMap_h
 
-#include "cmSystemTools.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <map>
+#include <string>
 
 class cmExportSet;
 
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 2916e6b..a0aefb8 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -12,10 +12,19 @@
 
 #include "cmExportTryCompileFileGenerator.h"
 
-#include "cmGeneratedFileStream.h"
+#include "cmGeneratorExpression.h"
 #include "cmGeneratorExpressionDAGChecker.h"
+#include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cm_auto_ptr.hxx"
+
+#include <map>
+#include <utility>
 
 cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
   cmGlobalGenerator* gg, const std::vector<std::string>& targets,
diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h
index 1d13711..27d5b3c 100644
--- a/Source/cmExportTryCompileFileGenerator.h
+++ b/Source/cmExportTryCompileFileGenerator.h
@@ -12,10 +12,18 @@
 #ifndef cmExportTryCompileFileGenerator_h
 #define cmExportTryCompileFileGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmExportFileGenerator.h"
 
-class cmInstallExportGenerator;
-class cmInstallTargetGenerator;
+#include <iosfwd>
+#include <set>
+#include <string>
+#include <vector>
+
+class cmGeneratorTarget;
+class cmGlobalGenerator;
+class cmMakefile;
 
 class cmExportTryCompileFileGenerator : public cmExportFileGenerator
 {
diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx
index 1a101ab..3a76367 100644
--- a/Source/cmExprParserHelper.cxx
+++ b/Source/cmExprParserHelper.cxx
@@ -11,11 +11,13 @@
 ============================================================================*/
 #include "cmExprParserHelper.h"
 
-#include "cmMakefile.h"
-#include "cmSystemTools.h"
+#include <cmConfigure.h>
 
 #include "cmExprLexer.h"
 
+#include <iostream>
+#include <sstream>
+
 int cmExpr_yyparse(yyscan_t yyscanner);
 //
 cmExprParserHelper::cmExprParserHelper()
diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h
index 8e3d996..7402484 100644
--- a/Source/cmExprParserHelper.h
+++ b/Source/cmExprParserHelper.h
@@ -12,9 +12,10 @@
 #ifndef cmExprParserHelper_h
 #define cmExprParserHelper_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <string>
+#include <vector>
 
 #define YYSTYPE cmExprParserHelper::ParserType
 #define YYSTYPE_IS_DECLARED
@@ -26,9 +27,6 @@
  *
  * Finds dependencies for java file and list of outputs
  */
-
-class cmMakefile;
-
 class cmExprParserHelper
 {
 public:
diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx
index b01290c..e4d124f 100644
--- a/Source/cmExternalMakefileProjectGenerator.cxx
+++ b/Source/cmExternalMakefileProjectGenerator.cxx
@@ -12,7 +12,7 @@
 
 #include "cmExternalMakefileProjectGenerator.h"
 
-#include <assert.h>
+class cmMakefile;
 
 void cmExternalMakefileProjectGenerator::EnableLanguage(
   std::vector<std::string> const& /*unused*/, cmMakefile* /*unused*/,
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h
index 7d10ce1..b306f19 100644
--- a/Source/cmExternalMakefileProjectGenerator.h
+++ b/Source/cmExternalMakefileProjectGenerator.h
@@ -12,13 +12,13 @@
 #ifndef cmExternalMakefileProjectGenerator_h
 #define cmExternalMakefileProjectGenerator_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
-
-#include "cmDocumentation.h"
+#include <string>
+#include <vector>
 
 class cmGlobalGenerator;
+class cmMakefile;
 
 /** \class cmExternalMakefileProjectGenerator
  * \brief Base class for generators for "External Makefile based IDE projects".
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 6eae26b..7eb3a74 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -12,16 +12,23 @@
 ============================================================================*/
 #include "cmExtraCodeBlocksGenerator.h"
 
+#include "cmAlgorithms.h"
 #include "cmGeneratedFileStream.h"
-#include "cmGlobalUnixMakefileGenerator3.h"
-#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
 #include "cmXMLWriter.h"
 #include "cmake.h"
 
-#include <cmsys/SystemTools.hxx>
+#include <algorithm>
+#include <map>
+#include <ostream>
+#include <string.h>
+#include <utility>
 
 /* Some useful URLs:
 Homepage:
diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h
index b39080c..179be30 100644
--- a/Source/cmExtraCodeBlocksGenerator.h
+++ b/Source/cmExtraCodeBlocksGenerator.h
@@ -13,11 +13,16 @@
 #ifndef cmExtraCodeBlocksGenerator_h
 #define cmExtraCodeBlocksGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmExternalMakefileProjectGenerator.h"
 
+#include <string>
+#include <vector>
+
+class cmGeneratorTarget;
 class cmLocalGenerator;
 class cmMakefile;
-class cmGeneratorTarget;
 class cmXMLWriter;
 
 /** \class cmExtraCodeBlocksGenerator
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index eda6867..a039f49 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -14,18 +14,22 @@
 #include "cmExtraCodeLiteGenerator.h"
 
 #include "cmGeneratedFileStream.h"
-#include "cmGlobalUnixMakefileGenerator3.h"
-#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
+#include "cmXMLWriter.h"
 #include "cmake.h"
 
-#include "cmStandardIncludes.h"
-#include "cmXMLWriter.h"
-#include <cmsys/Directory.hxx>
 #include <cmsys/SystemInformation.hxx>
-#include <cmsys/SystemTools.hxx>
+#include <map>
+#include <set>
+#include <sstream>
+#include <string.h>
+#include <utility>
 
 cmExtraCodeLiteGenerator::cmExtraCodeLiteGenerator()
   : cmExternalMakefileProjectGenerator()
diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h
index e20e745..f5765d8 100644
--- a/Source/cmExtraCodeLiteGenerator.h
+++ b/Source/cmExtraCodeLiteGenerator.h
@@ -14,9 +14,15 @@
 #ifndef cmGlobalCodeLiteGenerator_h
 #define cmGlobalCodeLiteGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmExternalMakefileProjectGenerator.h"
 
+#include <string>
+#include <vector>
+
 class cmLocalGenerator;
+class cmMakefile;
 
 class cmExtraCodeLiteGenerator : public cmExternalMakefileProjectGenerator
 {
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 945ee40..5a98e34 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -14,17 +14,26 @@
 #include "cmExtraEclipseCDT4Generator.h"
 
 #include "cmGeneratedFileStream.h"
-#include "cmGlobalUnixMakefileGenerator3.h"
-#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmGeneratorExpression.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmOutputConverter.h"
 #include "cmSourceFile.h"
+#include "cmSourceGroup.h"
 #include "cmState.h"
-#include "cmTarget.h"
+#include "cmSystemTools.h"
 #include "cmXMLWriter.h"
+#include "cmake.h"
 
-#include "cmSystemTools.h"
+#include <algorithm>
 #include <assert.h>
-#include <stdlib.h>
+#include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <sstream>
+#include <stdio.h>
+#include <utility>
 
 static void AppendAttribute(cmXMLWriter& xml, const char* keyval)
 {
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 4b585c3..97b7bd7 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -14,11 +14,19 @@
 #ifndef cmExtraEclipseCDT4Generator_h
 #define cmExtraEclipseCDT4Generator_h
 
+#include <cmConfigure.h>
+
 #include "cmExternalMakefileProjectGenerator.h"
 
+#include <iosfwd>
+#include <set>
+#include <string>
+#include <vector>
+
+class cmLocalGenerator;
 class cmMakefile;
-class cmXMLWriter;
 class cmSourceGroup;
+class cmXMLWriter;
 
 /** \class cmExtraEclipseCDT4Generator
  * \brief Write Eclipse project files for Makefile based projects
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 4e72504..36ab5b3 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -13,14 +13,18 @@
 #include "cmExtraKateGenerator.h"
 
 #include "cmGeneratedFileStream.h"
-#include "cmGlobalUnixMakefileGenerator3.h"
-#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
-#include "cmake.h"
 
-#include <cmsys/SystemTools.hxx>
+#include <ostream>
+#include <set>
+#include <string.h>
+#include <vector>
 
 cmExtraKateGenerator::cmExtraKateGenerator()
   : cmExternalMakefileProjectGenerator()
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index 3d16052..518dead 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -13,10 +13,14 @@
 #ifndef cmExtraKateGenerator_h
 #define cmExtraKateGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmExternalMakefileProjectGenerator.h"
 
-class cmLocalGenerator;
+#include <string>
+
 class cmGeneratedFileStream;
+class cmLocalGenerator;
 
 /** \class cmExtraKateGenerator
  * \brief Write Kate project files for Makefile or ninja based projects
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 6e81ee1..8ee275a 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -14,15 +14,18 @@
 
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
-#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
-#include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
-#include "cmake.h"
 
-#include <cmsys/SystemTools.hxx>
+#include <cmsys/RegularExpression.hxx>
+#include <ostream>
+#include <set>
+#include <string.h>
+#include <utility>
 
 /*
 Sublime Text 2 Generator
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index c087825..ee2b253 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -13,13 +13,19 @@
 #ifndef cmExtraSublimeTextGenerator_h
 #define cmExtraSublimeTextGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmExternalMakefileProjectGenerator.h"
-#include "cmSourceFile.h"
 
-class cmLocalGenerator;
-class cmMakefile;
+#include <map>
+#include <string>
+#include <vector>
+
 class cmGeneratedFileStream;
 class cmGeneratorTarget;
+class cmLocalGenerator;
+class cmMakefile;
+class cmSourceFile;
 
 /** \class cmExtraSublimeTextGenerator
  * \brief Write Sublime Text 2 project files for Makefile based projects
diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h
index 38b90e1..90bb1b2 100644
--- a/Source/cmFileLock.h
+++ b/Source/cmFileLock.h
@@ -13,9 +13,9 @@
 #ifndef cmFileLock_h
 #define cmFileLock_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <string>
 
 #if defined(_WIN32)
 #include <windows.h> // HANDLE
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h
index a3883da..d1883e7 100644
--- a/Source/cmFileLockPool.h
+++ b/Source/cmFileLockPool.h
@@ -12,14 +12,13 @@
 #ifndef cmFileLockPool_h
 #define cmFileLockPool_h
 
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
 #include <list>
+#include <string>
 
-class cmFileLockResult;
 class cmFileLock;
+class cmFileLockResult;
 
 class cmFileLockPool
 {
diff --git a/Source/cmFileLockResult.cxx b/Source/cmFileLockResult.cxx
index 090fe60..de851bc 100644
--- a/Source/cmFileLockResult.cxx
+++ b/Source/cmFileLockResult.cxx
@@ -13,6 +13,7 @@
 #include "cmFileLockResult.h"
 
 #include <errno.h>
+#include <string.h>
 
 cmFileLockResult cmFileLockResult::MakeOk()
 {
diff --git a/Source/cmFileLockResult.h b/Source/cmFileLockResult.h
index 10d4c13..54b9626 100644
--- a/Source/cmFileLockResult.h
+++ b/Source/cmFileLockResult.h
@@ -13,9 +13,9 @@
 #ifndef cmFileLockResult_h
 #define cmFileLockResult_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <string>
 
 #if defined(_WIN32)
 #include <windows.h> // DWORD
diff --git a/Source/cmFilePathUuid.cxx b/Source/cmFilePathUuid.cxx
index f99646c..b2def51 100644
--- a/Source/cmFilePathUuid.cxx
+++ b/Source/cmFilePathUuid.cxx
@@ -17,6 +17,8 @@
 #include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+#include <vector>
+
 cmFilePathUuid::cmFilePathUuid(cmMakefile* makefile)
 {
   initParentDirs(makefile->GetCurrentSourceDirectory(),
diff --git a/Source/cmFilePathUuid.h b/Source/cmFilePathUuid.h
index 619c71b..87cfcf8 100644
--- a/Source/cmFilePathUuid.h
+++ b/Source/cmFilePathUuid.h
@@ -13,10 +13,9 @@
 #ifndef cmFilePathUuid_h
 #define cmFilePathUuid_h
 
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
+#include <stddef.h>
 #include <string>
 #include <utility>
 
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx
index 1360b44..089d520 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeComparison.cxx
@@ -11,6 +11,11 @@
 ============================================================================*/
 #include "cmFileTimeComparison.h"
 
+#include <cmConfigure.h>
+#include <string>
+#include <time.h>
+#include <utility>
+
 // Use a hash table to avoid duplicate file time checks from disk.
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #ifdef CMake_HAVE_CXX_UNORDERED_MAP
@@ -20,16 +25,14 @@
 #endif
 #endif
 
-#include <cmsys/Encoding.hxx>
-
 // Use a platform-specific API to get file times efficiently.
 #if !defined(_WIN32) || defined(__CYGWIN__)
-#define cmFileTimeComparison_Type struct stat
-#include <ctype.h>
 #include <sys/stat.h>
+#define cmFileTimeComparison_Type struct stat
 #else
-#define cmFileTimeComparison_Type FILETIME
+#include <cmsys/Encoding.hxx>
 #include <windows.h>
+#define cmFileTimeComparison_Type FILETIME
 #endif
 
 class cmFileTimeComparisonInternal
diff --git a/Source/cmFileTimeComparison.h b/Source/cmFileTimeComparison.h
index 52e974c..ea5c47e 100644
--- a/Source/cmFileTimeComparison.h
+++ b/Source/cmFileTimeComparison.h
@@ -12,9 +12,7 @@
 #ifndef cmFileTimeComparison_h
 #define cmFileTimeComparison_h
 
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
 class cmFileTimeComparisonInternal;
 
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index 30a33b4..71edf9f 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/Source/cmFortranParserImpl.cxx
@@ -10,9 +10,16 @@
   See the License for more information.
 ============================================================================*/
 #include "cmFortranParser.h"
-
+#include "cmFortranLexer.h"
 #include "cmSystemTools.h"
+
 #include <assert.h>
+#include <cmConfigure.h>
+#include <set>
+#include <stack>
+#include <stdio.h>
+#include <string>
+#include <vector>
 
 bool cmFortranParser_s::FindIncludeFile(const char* dir,
                                         const char* includeName,
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index c35a1bc..9a83070 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -13,6 +13,8 @@
 
 #include "cmSystemTools.h"
 
+#include <stdio.h>
+
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include <cm_zlib.h>
 #endif
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index e5e3320..4c4f26b 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -14,9 +14,8 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
 #include <cmsys/FStream.hxx>
+#include <string>
 
 // This is the first base class of cmGeneratedFileStream.  It will be
 // created before and destroyed after the ofstream portion and can
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 6cd6439..b016d9e 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -13,12 +13,14 @@
 
 #include "assert.h"
 #include "cmAlgorithms.h"
-#include "cmSystemTools.h"
-
-#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmGeneratorExpressionContext.h"
 #include "cmGeneratorExpressionEvaluator.h"
 #include "cmGeneratorExpressionLexer.h"
 #include "cmGeneratorExpressionParser.h"
+#include "cmSystemTools.h"
+
+#include <cmsys/RegularExpression.hxx>
+#include <utility>
 
 cmGeneratorExpression::cmGeneratorExpression(
   const cmListFileBacktrace& backtrace)
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 75e69b4..24233b3 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -15,22 +15,20 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
 #include "cmListFileCache.h"
 
 #include <cm_auto_ptr.hxx>
-#include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
 
+class cmCompiledGeneratorExpression;
 class cmGeneratorTarget;
 class cmLocalGenerator;
-class cmListFileBacktrace;
-
-struct cmGeneratorExpressionEvaluator;
 struct cmGeneratorExpressionContext;
 struct cmGeneratorExpressionDAGChecker;
-
-class cmCompiledGeneratorExpression;
+struct cmGeneratorExpressionEvaluator;
 
 /** \class cmGeneratorExpression
  * \brief Evaluate generate-time query expression syntax.
diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx
index 8da6b50..77289d1 100644
--- a/Source/cmGeneratorExpressionContext.cxx
+++ b/Source/cmGeneratorExpressionContext.cxx
@@ -12,8 +12,6 @@
 
 #include "cmGeneratorExpressionContext.h"
 
-#include "cmGeneratorTarget.h"
-
 cmGeneratorExpressionContext::cmGeneratorExpressionContext(
   cmLocalGenerator* lg, std::string const& config, bool quiet,
   cmGeneratorTarget const* headTarget, const cmGeneratorTarget* currentTarget,
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 045ded1..c477443 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -13,7 +13,15 @@
 #include "cmGeneratorExpressionDAGChecker.h"
 
 #include "cmAlgorithms.h"
+#include "cmGeneratorExpressionContext.h"
+#include "cmGeneratorExpressionEvaluator.h"
+#include "cmGeneratorTarget.h"
 #include "cmLocalGenerator.h"
+#include "cmake.h"
+
+#include <sstream>
+#include <string.h>
+#include <utility>
 
 cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
   const cmListFileBacktrace& backtrace, const std::string& target,
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index e522728..c6d7281 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -14,9 +14,14 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
+#include "cmListFileCache.h"
 
-#include "cmGeneratorExpressionEvaluator.h"
+#include <map>
+#include <set>
+#include <string>
+
+struct GeneratorExpressionContent;
+struct cmGeneratorExpressionContext;
 
 #define CM_SELECT_BOTH(F, A1, A2) F(A1, A2)
 #define CM_SELECT_FIRST(F, A1, A2) F(A1)
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index c01c4fc..aad9d1b 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -14,12 +14,17 @@
 
 #include "cmGeneratedFileStream.h"
 #include "cmGlobalGenerator.h"
+#include "cmListFileCache.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include <cmsys/FStream.hxx>
+#include "cmSystemTools.h"
+#include "cmake.h"
 
-#include <assert.h>
+#include <cmConfigure.h>
+#include <cmsys/FStream.hxx>
+#include <sstream>
+#include <utility>
 
 cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
   const std::string& input,
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index 52ba2d8..3a668a2 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -12,10 +12,15 @@
 #ifndef cmGeneratorExpressionEvaluationFile_h
 #define cmGeneratorExpressionEvaluationFile_h
 
+#include <cmConfigure.h> // IWYU pragma: keep
+
 #include "cmGeneratorExpression.h"
 
 #include <cm_auto_ptr.hxx>
+#include <map>
+#include <string>
 #include <sys/types.h>
+#include <vector>
 
 class cmLocalGenerator;
 
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index b4b74c5..d21ab25 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -12,21 +12,12 @@
 #include "cmGeneratorExpressionEvaluator.h"
 
 #include "cmAlgorithms.h"
-#include "cmGeneratorExpression.h"
-#include "cmGeneratorExpressionDAGChecker.h"
-#include "cmGeneratorExpressionParser.h"
-#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
-#include "cmSourceFile.h"
-
-#include <cmsys/String.h>
-
-#include <assert.h>
-#include <errno.h>
-
+#include "cmGeneratorExpressionContext.h"
 #include "cmGeneratorExpressionNode.h"
 
+#include <algorithm>
+#include <sstream>
+
 GeneratorExpressionContent::GeneratorExpressionContent(
   const char* startContent, size_t length)
   : StartContent(startContent)
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 58e732b..5e8ebe0 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -12,13 +12,13 @@
 #ifndef cmGeneratorExpressionEvaluator_h
 #define cmGeneratorExpressionEvaluator_h
 
-#include "cmGeneratorExpressionContext.h"
-
-#include "cmListFileCache.h"
+#include <cmConfigure.h>
 
+#include <stddef.h>
 #include <string>
 #include <vector>
 
+struct cmGeneratorExpressionContext;
 struct cmGeneratorExpressionDAGChecker;
 struct cmGeneratorExpressionNode;
 
diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h
index 6bd336b..55836ac 100644
--- a/Source/cmGeneratorExpressionLexer.h
+++ b/Source/cmGeneratorExpressionLexer.h
@@ -12,10 +12,10 @@
 #ifndef cmGeneratorExpressionLexer_h
 #define cmGeneratorExpressionLexer_h
 
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
+#include <stddef.h>
+#include <string>
 #include <vector>
 
 struct cmGeneratorExpressionToken
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 12cf980..44e9ce1 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -13,9 +13,36 @@
 #include "cmGeneratorExpressionNode.h"
 
 #include "cmAlgorithms.h"
+#include "cmGeneratorExpression.h"
+#include "cmGeneratorExpressionContext.h"
+#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmGeneratorExpressionEvaluator.h"
+#include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
+#include "cmLinkItem.h"
+#include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmOutputConverter.h"
+#include "cmPolicies.h"
+#include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
+
+#include <algorithm>
+#include <assert.h>
+#include <cmConfigure.h>
+#include <cmsys/RegularExpression.hxx>
+#include <cmsys/String.h>
+#include <errno.h>
+#include <map>
+#include <set>
+#include <sstream>
+#include <stdlib.h>
+#include <string.h>
+#include <utility>
 
 std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
   std::string const& prop, cmLocalGenerator* lg,
@@ -1455,13 +1482,12 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode
 
 } installPrefixNode;
 
-class ArtifactNameTag;
+class ArtifactDirTag;
 class ArtifactLinkerTag;
-class ArtifactSonameTag;
-class ArtifactPdbTag;
-
+class ArtifactNameTag;
 class ArtifactPathTag;
-class ArtifactDirTag;
+class ArtifactPdbTag;
+class ArtifactSonameTag;
 
 template <typename ArtifactT>
 struct TargetFilesystemArtifactResultCreator
diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h
index 3ee57eb..23f405b 100644
--- a/Source/cmGeneratorExpressionNode.h
+++ b/Source/cmGeneratorExpressionNode.h
@@ -12,20 +12,16 @@
 #ifndef cmGeneratorExpressionNode_h
 #define cmGeneratorExpressionNode_h
 
-#include "cmGeneratorExpression.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmGeneratorExpressionDAGChecker.h"
-#include "cmGeneratorExpressionEvaluator.h"
-#include "cmGeneratorExpressionParser.h"
-#include "cmLocalGenerator.h"
-#include "cmSourceFile.h"
+#include <string>
+#include <vector>
 
-#include <cmsys/String.h>
-
-#include <assert.h>
-#include <errno.h>
-
-#include "cmListFileCache.h"
+class cmGeneratorTarget;
+class cmLocalGenerator;
+struct GeneratorExpressionContent;
+struct cmGeneratorExpressionContext;
+struct cmGeneratorExpressionDAGChecker;
 
 struct cmGeneratorExpressionNode
 {
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index f853f8d..c753f9b 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -14,7 +14,8 @@
 
 #include "cmGeneratorExpressionEvaluator.h"
 
-#include "assert.h"
+#include <assert.h>
+#include <stddef.h>
 
 cmGeneratorExpressionParser::cmGeneratorExpressionParser(
   const std::vector<cmGeneratorExpressionToken>& tokens)
diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h
index b0e9ea4..4534d6b 100644
--- a/Source/cmGeneratorExpressionParser.h
+++ b/Source/cmGeneratorExpressionParser.h
@@ -12,12 +12,11 @@
 #ifndef cmGeneratorExpressionParser_h
 #define cmGeneratorExpressionParser_h
 
-#include "cmGeneratorExpressionLexer.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include <set>
 #include <vector>
 
-#include "cmListFileCache.h"
+#include "cmGeneratorExpressionLexer.h"
 
 struct cmGeneratorExpressionEvaluator;
 
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 8bd3b82..ee2907c 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -13,19 +13,33 @@
 
 #include "cmAlgorithms.h"
 #include "cmComputeLinkInformation.h"
+#include "cmCustomCommand.h"
 #include "cmCustomCommandGenerator.h"
+#include "cmCustomCommandLines.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpressionDAGChecker.h"
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmPropertyMap.h"
 #include "cmSourceFile.h"
+#include "cmSourceFileLocation.h"
+#include "cmSystemTools.h"
 #include "cmTarget.h"
+#include "cmTargetLinkLibraryType.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
 
-#include <queue>
-
-#include "assert.h"
+#include <algorithm>
+#include <assert.h>
+#include <cmsys/RegularExpression.hxx>
 #include <errno.h>
+#include <iterator>
+#include <queue>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #if defined(CMake_HAVE_CXX_UNORDERED_SET)
 #include <unordered_set>
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index f9987aa..173f15d 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -12,15 +12,26 @@
 #ifndef cmGeneratorTarget_h
 #define cmGeneratorTarget_h
 
+#include <cmConfigure.h>
+
 #include "cmLinkItem.h"
+#include "cmListFileCache.h"
+#include "cmPolicies.h"
+#include "cmState.h"
+
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
 
+class cmComputeLinkInformation;
 class cmCustomCommand;
 class cmGlobalGenerator;
 class cmLocalGenerator;
 class cmMakefile;
 class cmSourceFile;
 class cmTarget;
-class cmComputeLinkInformation;
 
 class cmGeneratorTarget
 {
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 3d35114..d3c9625 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -12,6 +12,7 @@
 #include "cmGhsMultiTargetGenerator.h"
 
 #include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
 #include "cmGlobalGhsMultiGenerator.h"
 #include "cmLocalGhsMultiGenerator.h"
 #include "cmMakefile.h"
diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx
index 900b08e..d8ea317 100644
--- a/Source/cmGlobalCommonGenerator.cxx
+++ b/Source/cmGlobalCommonGenerator.cxx
@@ -11,6 +11,8 @@
 ============================================================================*/
 #include "cmGlobalCommonGenerator.h"
 
+class cmake;
+
 cmGlobalCommonGenerator::cmGlobalCommonGenerator(cmake* cm)
   : cmGlobalGenerator(cm)
 {
diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h
index a48ff4f..5bc16c3 100644
--- a/Source/cmGlobalCommonGenerator.h
+++ b/Source/cmGlobalCommonGenerator.h
@@ -12,8 +12,12 @@
 #ifndef cmGlobalCommonGenerator_h
 #define cmGlobalCommonGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmGlobalGenerator.h"
 
+class cmake;
+
 /** \class cmGlobalCommonGenerator
  * \brief Common infrastructure for Makefile and Ninja global generators.
  */
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 50c5a42..ef8266f 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -21,6 +21,8 @@
 #include "cmAlgorithms.h"
 #include "cmCPackPropertiesGenerator.h"
 #include "cmComputeTargetDepends.h"
+#include "cmCustomCommand.h"
+#include "cmCustomCommandLines.h"
 #include "cmExportBuildFileGenerator.h"
 #include "cmExternalMakefileProjectGenerator.h"
 #include "cmGeneratedFileStream.h"
@@ -29,25 +31,31 @@
 #include "cmInstallGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmOutputConverter.h"
+#include "cmPolicies.h"
 #include "cmQtAutoGeneratorInitializer.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
-#include "cmTargetExport.h"
 #include "cmVersion.h"
 #include "cmake.h"
 
+#include <algorithm>
+#include <assert.h>
 #include <cmsys/Directory.hxx>
 #include <cmsys/FStream.hxx>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
+#include <cm_jsoncpp_value.h>
+#include <cm_jsoncpp_writer.h>
 #include <cmsys/MD5.h>
 #endif
 
-#include <stdlib.h> // required for atof
-
-#include <assert.h>
+class cmInstalledFile;
 
 bool cmTarget::StrictTargetComparison::operator()(cmTarget const* t1,
                                                   cmTarget const* t2) const
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index dc80a33..1e1479a 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -15,15 +15,18 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
-#include "cmExportSetMap.h" // For cmExportSetMap
-#include "cmGeneratorExpression.h"
-#include "cmGeneratorTarget.h"
+#include "cmExportSetMap.h"
 #include "cmState.h"
-#include "cmSystemTools.h"  // for cmSystemTools::OutputOption
-#include "cmTarget.h"       // For cmTargets
-#include "cmTargetDepend.h" // For cmTargetDependSet
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmTargetDepend.h"
+
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include "cmFileLockPool.h"
@@ -34,15 +37,14 @@
 #endif
 #endif
 
-class cmake;
+class cmCustomCommandLines;
+class cmSourceFile;
+class cmExportBuildFileGenerator;
+class cmExternalMakefileProjectGenerator;
 class cmGeneratorTarget;
-class cmMakefile;
 class cmLocalGenerator;
-class cmExternalMakefileProjectGenerator;
-class cmTarget;
-class cmInstallTargetGenerator;
-class cmInstallFilesGenerator;
-class cmExportBuildFileGenerator;
+class cmMakefile;
+class cmake;
 
 /** \class cmGlobalGenerator
  * \brief Responsible for overseeing the generation process for the entire tree
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 0ae913e..d75ebf8 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -12,6 +12,7 @@
 #include "cmGlobalGhsMultiGenerator.h"
 
 #include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
 #include "cmGhsMultiTargetGenerator.h"
 #include "cmLocalGhsMultiGenerator.h"
 #include "cmMakefile.h"
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index daf7003..aaa1108 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -13,17 +13,23 @@
 #include "cmGlobalKdevelopGenerator.h"
 
 #include "cmGeneratedFileStream.h"
-#include "cmGlobalUnixMakefileGenerator3.h"
-#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmXMLWriter.h"
 #include "cmake.h"
 
 #include <cmsys/Directory.hxx>
 #include <cmsys/FStream.hxx>
-#include <cmsys/SystemTools.hxx>
+#include <map>
+#include <set>
+#include <string.h>
+#include <utility>
 
 cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
   : cmExternalMakefileProjectGenerator()
diff --git a/Source/cmGlobalKdevelopGenerator.h b/Source/cmGlobalKdevelopGenerator.h
index 666527c..6a201b0 100644
--- a/Source/cmGlobalKdevelopGenerator.h
+++ b/Source/cmGlobalKdevelopGenerator.h
@@ -13,8 +13,13 @@
 #ifndef cmGlobalKdevelopGenerator_h
 #define cmGlobalKdevelopGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmExternalMakefileProjectGenerator.h"
 
+#include <string>
+#include <vector>
+
 class cmLocalGenerator;
 
 /** \class cmGlobalKdevelopGenerator
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 590f207..30a05a0 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -13,16 +13,27 @@
 #include "cmGlobalNinjaGenerator.h"
 
 #include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorExpressionEvaluationFile.h"
 #include "cmGeneratorTarget.h"
+#include "cmLocalGenerator.h"
 #include "cmLocalNinjaGenerator.h"
 #include "cmMakefile.h"
+#include "cmOutputConverter.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmTargetDepend.h"
 #include "cmVersion.h"
+#include "cmake.h"
 
 #include <algorithm>
-#include <assert.h>
 #include <ctype.h>
+#include <functional>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
 
 const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
 const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 082ee3a..a0fad64 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -13,16 +13,28 @@
 #ifndef cmGlobalNinjaGenerator_h
 #define cmGlobalNinjaGenerator_h
 
-#include "cmGlobalCommonGenerator.h"
+#include <cmConfigure.h>
 
+#include "cmGlobalCommonGenerator.h"
+#include "cmGlobalGenerator.h"
 #include "cmGlobalGeneratorFactory.h"
 #include "cmNinjaTypes.h"
-
-//#define NINJA_GEN_VERBOSE_FILES
-
-class cmLocalGenerator;
+#include "cmPolicies.h"
+
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+class cmCustomCommand;
+class cmMakefile;
+class cmake;
+struct cmDocumentationEntry;
 class cmGeneratedFileStream;
 class cmGeneratorTarget;
+class cmLocalGenerator;
 
 /**
  * \class cmGlobalNinjaGenerator
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 77fbbe9..d90ebf0 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -12,13 +12,25 @@
 #include "cmGlobalUnixMakefileGenerator3.h"
 
 #include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
 #include "cmMakefileTargetGenerator.h"
+#include "cmOutputConverter.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmTargetDepend.h"
 #include "cmake.h"
 
+#include <algorithm>
+#include <functional>
+#include <sstream>
+#include <utility>
+
 cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm)
   : cmGlobalCommonGenerator(cm)
 {
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index ceb4140..3724124 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -12,13 +12,27 @@
 #ifndef cmGlobalUnixMakefileGenerator3_h
 #define cmGlobalUnixMakefileGenerator3_h
 
-#include "cmGlobalCommonGenerator.h"
+#include <cmConfigure.h>
 
+#include "cmGeneratorTarget.h"
+#include "cmGlobalCommonGenerator.h"
 #include "cmGlobalGeneratorFactory.h"
+#include "cmState.h"
+
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <stddef.h>
+#include <string>
+#include <vector>
 
 class cmGeneratedFileStream;
-class cmMakefileTargetGenerator;
+class cmLocalGenerator;
 class cmLocalUnixMakefileGenerator3;
+class cmMakefile;
+class cmMakefileTargetGenerator;
+class cmake;
+struct cmDocumentationEntry;
 
 /** \class cmGlobalUnixMakefileGenerator3
  * \brief Write a Unix makefiles.
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index df831e5..819feb1 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -14,6 +14,7 @@
 #include "cmGlobalVisualStudio10Generator.h"
 
 #include "cmAlgorithms.h"
+#include "cmGeneratorTarget.h"
 #include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 45d9522..ea008ad 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -13,6 +13,7 @@
 
 #include "cmGlobalVisualStudio71Generator.h"
 
+#include "cmGeneratorTarget.h"
 #include "cmLocalVisualStudio7Generator.h"
 #include "cmMakefile.h"
 #include "cmake.h"
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 67ac230..08be304 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -14,6 +14,7 @@
 #include "cmGlobalVisualStudio7Generator.h"
 
 #include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
 #include "cmLocalVisualStudio7Generator.h"
 #include "cmMakefile.h"
 #include "cmUuid.h"
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 2c0168e..53a05a0 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -14,6 +14,7 @@
 #include "cmGlobalVisualStudio8Generator.h"
 
 #include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
 #include "cmLocalVisualStudio7Generator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 86fe6f2..d8f1d93 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -11,8 +11,10 @@
 ============================================================================*/
 #include "cmGlobalWatcomWMakeGenerator.h"
 
-#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmDocumentationEntry.h"
 #include "cmMakefile.h"
+#include "cmState.h"
+#include "cmake.h"
 
 cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
   : cmGlobalUnixMakefileGenerator3(cm)
diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h
index bc0d786..df1168e 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.h
+++ b/Source/cmGlobalWatcomWMakeGenerator.h
@@ -12,8 +12,18 @@
 #ifndef cmGlobalWatcomWMakeGenerator_h
 #define cmGlobalWatcomWMakeGenerator_h
 
+#include <cmConfigure.h>
+
+#include "cmGlobalGeneratorFactory.h"
 #include "cmGlobalUnixMakefileGenerator3.h"
 
+#include <string>
+#include <vector>
+
+class cmMakefile;
+class cmake;
+struct cmDocumentationEntry;
+
 /** \class cmGlobalWatcomWMakeGenerator
  * \brief Write a NMake makefiles.
  *
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index adb9936..2824f7e 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -12,9 +12,19 @@
 #include "cmGraphVizWriter.h"
 
 #include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
+
+#include <cmConfigure.h>
+#include <iostream>
+#include <sstream>
+#include <utility>
 
 static const char* getShapeForTarget(const cmGeneratorTarget* target)
 {
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
index 0643785..f34e967 100644
--- a/Source/cmGraphVizWriter.h
+++ b/Source/cmGraphVizWriter.h
@@ -12,15 +12,19 @@
 #ifndef CMGRAPHVIZWRITER_H
 #define CMGRAPHVIZWRITER_H
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include "cmState.h"
 
-#include "cmGeneratedFileStream.h"
-#include "cmLocalGenerator.h"
 #include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
 
+class cmGeneratedFileStream;
 class cmGeneratorTarget;
+class cmLocalGenerator;
 
 /** This class implements writing files for graphviz (dot) for graphs
  * representing the dependencies between the targets in the project. */
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 469b119..3b4226d 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -12,8 +12,11 @@
 #include "cmInstallDirectoryGenerator.h"
 
 #include "cmGeneratorExpression.h"
+#include "cmInstallType.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
 
 cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
   std::vector<std::string> const& dirs, const char* dest,
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 93becf4..ed40785 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -13,6 +13,14 @@
 #define cmInstallDirectoryGenerator_h
 
 #include "cmInstallGenerator.h"
+#include "cmScriptGenerator.h"
+
+#include <cmConfigure.h>
+#include <iosfwd>
+#include <string>
+#include <vector>
+
+class cmLocalGenerator;
 
 /** \class cmInstallDirectoryGenerator
  * \brief Generate directory installation rules.
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 72c4d1f..27628f4 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -11,19 +11,17 @@
 ============================================================================*/
 #include "cmInstallExportGenerator.h"
 
-#include <stdio.h>
-
-#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmInstallTargetGenerator.h"
-#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
-#include "cmake.h"
-
-#include "cmInstallFilesGenerator.h"
+#include <algorithm>
+#include <map>
+#include <sstream>
+#include <utility>
 
 #include "cmExportInstallFileGenerator.h"
 #include "cmExportSet.h"
+#include "cmInstallType.h"
+#include "cmLocalGenerator.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
 
 cmInstallExportGenerator::cmInstallExportGenerator(
   cmExportSet* exportSet, const char* destination,
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 22e661b..5539827 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -12,13 +12,19 @@
 #ifndef cmInstallExportGenerator_h
 #define cmInstallExportGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmInstallGenerator.h"
+#include "cmScriptGenerator.h"
+
+#include <iosfwd>
+#include <stddef.h>
+#include <string>
+#include <vector>
 
 class cmExportInstallFileGenerator;
-class cmInstallFilesGenerator;
-class cmInstallTargetGenerator;
 class cmExportSet;
-class cmMakefile;
+class cmLocalGenerator;
 
 /** \class cmInstallExportGenerator
  * \brief Generate rules for creating an export files.
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 93a740c..1d0fadd 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -12,9 +12,11 @@
 #include "cmInstallFilesGenerator.h"
 
 #include "cmGeneratorExpression.h"
-#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
+#include "cmInstallType.h"
 #include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
+
+class cmLocalGenerator;
 
 cmInstallFilesGenerator::cmInstallFilesGenerator(
   std::vector<std::string> const& files, const char* dest, bool programs,
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 5cb09f4..1648976 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -12,7 +12,16 @@
 #ifndef cmInstallFilesGenerator_h
 #define cmInstallFilesGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmInstallGenerator.h"
+#include "cmScriptGenerator.h"
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+
+class cmLocalGenerator;
 
 /** \class cmInstallFilesGenerator
  * \brief Generate file installation rules.
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index e3d5bad..69120a8 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -14,6 +14,8 @@
 #include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+#include <ostream>
+
 cmInstallGenerator::cmInstallGenerator(
   const char* destination, std::vector<std::string> const& configurations,
   const char* component, MessageLevel message, bool exclude_from_all)
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index ad9fc28..fa0bdd6 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -12,9 +12,15 @@
 #ifndef cmInstallGenerator_h
 #define cmInstallGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmInstallType.h"
 #include "cmScriptGenerator.h"
 
+#include <iosfwd>
+#include <string>
+#include <vector>
+
 class cmLocalGenerator;
 class cmMakefile;
 
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index 76d6b71..7871100 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -11,6 +11,11 @@
 ============================================================================*/
 #include "cmInstallScriptGenerator.h"
 
+#include "cmScriptGenerator.h"
+
+#include <ostream>
+#include <vector>
+
 cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script,
                                                    bool code,
                                                    const char* component,
diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h
index dc00359..609294f 100644
--- a/Source/cmInstallScriptGenerator.h
+++ b/Source/cmInstallScriptGenerator.h
@@ -12,8 +12,13 @@
 #ifndef cmInstallScriptGenerator_h
 #define cmInstallScriptGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmInstallGenerator.h"
 
+#include <iosfwd>
+#include <string>
+
 /** \class cmInstallScriptGenerator
  * \brief Generate target installation rules.
  */
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 4b2f40c..1ad59ff 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -14,13 +14,21 @@
 #include "cmComputeLinkInformation.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorTarget.h"
-#include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
+#include "cmInstallType.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cm_auto_ptr.hxx"
 #include "cmake.h"
 
 #include <assert.h>
+#include <map>
+#include <set>
+#include <sstream>
+#include <utility>
 
 cmInstallTargetGenerator::cmInstallTargetGenerator(
   const std::string& targetName, const char* dest, bool implib,
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index b1c28b8..797e962 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -12,9 +12,17 @@
 #ifndef cmInstallTargetGenerator_h
 #define cmInstallTargetGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmInstallGenerator.h"
+#include "cmScriptGenerator.h"
+
+#include <iosfwd>
+#include <string>
+#include <vector>
 
 class cmGeneratorTarget;
+class cmLocalGenerator;
 
 /** \class cmInstallTargetGenerator
  * \brief Generate target installation rules.
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index bfc5cf1..3ab7db0 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -12,9 +12,13 @@
 #include "cmInstalledFile.h"
 
 #include "cmAlgorithms.h"
+#include "cmListFileCache.h"
 #include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+#include <cmConfigure.h>
+#include <utility>
+
 cmInstalledFile::cmInstalledFile()
   : NameExpression(CM_NULLPTR)
 {
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index 00ff611..8bad5a5 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -13,6 +13,13 @@
 #define cmInstalledFile_h
 
 #include "cmGeneratorExpression.h"
+#include "cm_auto_ptr.hxx"
+
+#include <map>
+#include <string>
+#include <vector>
+
+class cmMakefile;
 
 /** \class cmInstalledFile
  * \brief Represents a file intended for installation.
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index aad538c..14bb81e 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -15,9 +15,12 @@
 #include "cmMessenger.h"
 #include "cmOutputConverter.h"
 #include "cmSystemTools.h"
-#include "cmVersion.h"
+#include "cmake.h"
 
-#include <cmsys/RegularExpression.hxx>
+#include <algorithm>
+#include <assert.h>
+#include <cmConfigure.h>
+#include <sstream>
 
 struct cmListFileParser
 {
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 08b59eb..215f179 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -12,9 +12,11 @@
 #ifndef cmListFileCache_h
 #define cmListFileCache_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <iosfwd>
+#include <string>
+#include <vector>
 
 #include "cmState.h"
 
@@ -151,6 +153,7 @@ public:
 
 private:
   struct Entry;
+
   cmState::Snapshot Bottom;
   Entry* Cur;
   cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 1383421..0e79293 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -11,8 +11,13 @@
 ============================================================================*/
 #include "cmLocalCommonGenerator.h"
 
+#include "cmGeneratorTarget.h"
 #include "cmMakefile.h"
 
+#include <vector>
+
+class cmGlobalGenerator;
+
 cmLocalCommonGenerator::cmLocalCommonGenerator(
   cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd)
   : cmLocalGenerator(gg, mf)
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index 0a8753d..9012afd 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -12,9 +12,16 @@
 #ifndef cmLocalCommonGenerator_h
 #define cmLocalCommonGenerator_h
 
+#include <cmConfigure.h>
+
 #include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
+
+#include <string>
 
-class cmCommonTargetGenerator;
+class cmGeneratorTarget;
+class cmGlobalGenerator;
+class cmMakefile;
 
 /** \class cmLocalCommonGenerator
  * \brief Common infrastructure for Makefile and Ninja local generators.
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index de9e1e5..cecf7b7 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -16,14 +16,15 @@
 #include "cmCustomCommandGenerator.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorExpressionEvaluationFile.h"
+#include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
-#include "cmInstallFilesGenerator.h"
 #include "cmInstallGenerator.h"
 #include "cmInstallScriptGenerator.h"
 #include "cmInstallTargetGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmTest.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmTestGenerator.h"
 #include "cmVersion.h"
 #include "cmake.h"
@@ -33,9 +34,14 @@
 #include <cmsys/MD5.h>
 #endif
 
-#include <ctype.h> // for isalpha
-
+#include <algorithm>
 #include <assert.h>
+#include <cmsys/RegularExpression.hxx>
+#include <ctype.h>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
+#include <utility>
 
 #if defined(__HAIKU__)
 #include <FindDirectory.h>
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f7a4074..a43a7d1 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -14,19 +14,25 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
+#include "cmListFileCache.h"
 #include "cmOutputConverter.h"
+#include "cmPolicies.h"
 #include "cmState.h"
 #include "cmake.h"
 
-class cmMakefile;
-class cmGlobalGenerator;
+#include <cm_kwiml.h>
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string.h>
+#include <string>
+#include <vector>
+
+class cmCustomCommandGenerator;
 class cmGeneratorTarget;
-class cmTargetManifest;
+class cmGlobalGenerator;
+class cmMakefile;
 class cmSourceFile;
-class cmCustomCommand;
-class cmCustomCommandGenerator;
 
 /** \class cmLocalGenerator
  * \brief Create required build files for a directory.
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index d15ee22..6793f84 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -12,16 +12,25 @@
 ============================================================================*/
 #include "cmLocalNinjaGenerator.h"
 
+#include "cmCustomCommand.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
 #include "cmGlobalNinjaGenerator.h"
 #include "cmMakefile.h"
 #include "cmNinjaTargetGenerator.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
+#include "cmSystemTools.h"
 #include "cmake.h"
 
+#include <algorithm>
 #include <assert.h>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
+#include <utility>
 
 cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
                                              cmMakefile* mf)
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 6e61087..25539d4 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -13,13 +13,27 @@
 #ifndef cmLocalNinjaGenerator_h
 #define cmLocalNinjaGenerator_h
 
-#include "cmLocalCommonGenerator.h"
+#include <cmConfigure.h>
 
+#include "cmLocalCommonGenerator.h"
+#include "cmLocalGenerator.h"
 #include "cmNinjaTypes.h"
+#include "cmOutputConverter.h"
+
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
 
+class cmCustomCommand;
 class cmCustomCommandGenerator;
-class cmGlobalNinjaGenerator;
 class cmGeneratedFileStream;
+class cmGeneratorTarget;
+class cmGlobalGenerator;
+class cmGlobalNinjaGenerator;
+class cmMakefile;
+class cmSourceFile;
 class cmake;
 
 /**
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 3c4841e..611c502 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -12,13 +12,20 @@
 #include "cmLocalUnixMakefileGenerator3.h"
 
 #include "cmAlgorithms.h"
+#include "cmCustomCommand.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmFileTimeComparison.h"
 #include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
 #include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmMakefileTargetGenerator.h"
+#include "cmOutputConverter.h"
 #include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
 #include "cmVersion.h"
 #include "cmake.h"
 
@@ -30,11 +37,14 @@
 #include "cmDependsJava.h"
 #endif
 
+#include <algorithm>
 #include <cm_auto_ptr.hxx>
+#include <cmsys/FStream.hxx>
 #include <cmsys/Terminal.h>
-
-#include <algorithm>
-#include <queue>
+#include <functional>
+#include <sstream>
+#include <stdio.h>
+#include <utility>
 
 // Escape special characters in Makefile dependency lines
 class cmMakeSafe
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 3e90055..bd32e10 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -12,15 +12,22 @@
 #ifndef cmLocalUnixMakefileGenerator3_h
 #define cmLocalUnixMakefileGenerator3_h
 
-#include "cmLocalCommonGenerator.h"
+#include <cmConfigure.h>
 
-// for cmDepends::DependencyVector
 #include "cmDepends.h"
+#include "cmLocalCommonGenerator.h"
+
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
 
 class cmCustomCommand;
 class cmCustomCommandGenerator;
-class cmDepends;
-class cmMakefileTargetGenerator;
+class cmGeneratorTarget;
+class cmGlobalGenerator;
+class cmMakefile;
 class cmSourceFile;
 
 /** \class cmLocalUnixMakefileGenerator3
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 37b5505..0fe7987 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -11,10 +11,12 @@
 ============================================================================*/
 #include "cmLocalVisualStudio10Generator.h"
 
+#include "cmGeneratorTarget.h"
 #include "cmGlobalVisualStudio10Generator.h"
 #include "cmMakefile.h"
 #include "cmVisualStudio10TargetGenerator.h"
 #include "cmXMLParser.h"
+
 #include <cm_expat.h>
 
 class cmVS10XMLParser : public cmXMLParser
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index b492962..d344dc5 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -12,6 +12,7 @@
 #include "cmLocalVisualStudioGenerator.h"
 
 #include "cmCustomCommandGenerator.h"
+#include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index db87946..098779e 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -11,6 +11,7 @@
 ============================================================================*/
 #include "cmLocalXCodeGenerator.h"
 
+#include "cmGeneratorTarget.h"
 #include "cmGlobalXCodeGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index d1fddca..11ccca1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -23,34 +23,35 @@
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpressionEvaluationFile.h"
 #include "cmGlobalGenerator.h"
-#include "cmInstallGenerator.h"
 #include "cmListFileCache.h"
-#include "cmMessenger.h"
 #include "cmSourceFile.h"
 #include "cmSourceFileLocation.h"
 #include "cmState.h"
 #include "cmSystemTools.h"
 #include "cmTest.h"
-#include "cmTestGenerator.h"
 #include "cmVersion.h"
 #include "cmake.h"
 
+#include "cmInstallGenerator.h" // IWYU pragma: keep
+#include "cmTestGenerator.h"    // IWYU pragma: keep
+
 #ifdef CMAKE_BUILD_WITH_CMAKE
 #include "cmVariableWatch.h"
 #endif
 
+#include <algorithm>
+#include <assert.h>
 #include <cm_auto_ptr.hxx>
 #include <cmsys/FStream.hxx>
 #include <cmsys/RegularExpression.hxx>
-
-#include <algorithm>
-#include <assert.h>
 #include <ctype.h>
 #include <sstream>
 #include <stdlib.h>
 #include <string.h>
 #include <utility>
 
+class cmMessenger;
+
 // default is not to be building executables
 cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
                        cmState::Snapshot const& snapshot)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 4d137db..eb382df 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -54,6 +54,7 @@ class cmFunctionBlocker;
 class cmGeneratorExpressionEvaluationFile;
 class cmGlobalGenerator;
 class cmInstallGenerator;
+class cmMessenger;
 class cmSourceFile;
 class cmTest;
 class cmTestGenerator;
@@ -892,10 +893,13 @@ private:
   void PopSnapshot(bool reportError = true);
   friend class cmCMakePolicyCommand;
   class IncludeScope;
+
   friend class IncludeScope;
   class ListFileScope;
+
   friend class ListFileScope;
   class BuildsystemFileScope;
+
   friend class BuildsystemFileScope;
 
   // CMP0053 == old
diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx
index 43fa150..fe67050 100644
--- a/Source/cmMessenger.cxx
+++ b/Source/cmMessenger.cxx
@@ -11,14 +11,18 @@
 ============================================================================*/
 
 #include "cmMessenger.h"
+
+#include "cmAlgorithms.h"
 #include "cmDocumentationFormatter.h"
-#include "cmMessenger.h"
-#include "cmOutputConverter.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include <cmsys/SystemInformation.hxx>
 #endif
 
+#include <sstream>
+
 cmake::MessageType cmMessenger::ConvertMessageType(cmake::MessageType t) const
 {
   bool warningsAsErrors;
diff --git a/Source/cmMessenger.h b/Source/cmMessenger.h
index f15bf13..c69eb8e 100644
--- a/Source/cmMessenger.h
+++ b/Source/cmMessenger.h
@@ -13,10 +13,15 @@
 #ifndef cmMessenger_h
 #define cmMessenger_h
 
+#include <cmConfigure.h> // IWYU pragma: keep
+
 #include "cmListFileCache.h"
-#include "cmState.h"
 #include "cmake.h"
 
+#include <string>
+
+class cmState;
+
 class cmMessenger
 {
 public:
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index dbfe6eb..3ddcc9a 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -11,12 +11,18 @@
 ============================================================================*/
 #include "cmOSXBundleGenerator.h"
 
+#include <cmConfigure.h>
+
+#include "cmGeneratorTarget.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmSystemTools.h"
 #include "cmTarget.h"
 
 #include <cassert>
 
+class cmSourceFile;
+
 cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target,
                                            const std::string& configName)
   : GT(target)
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index 2dc1e4a..ff472ec 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/Source/cmOSXBundleGenerator.h
@@ -12,19 +12,16 @@
 #ifndef cmOSXBundleGenerator_h
 #define cmOSXBundleGenerator_h
 
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
-
-#include "cmSourceFile.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
 #include <set>
 #include <string>
+#include <vector>
 
-class cmTarget;
-class cmMakefile;
-class cmLocalGenerator;
 class cmGeneratorTarget;
+class cmLocalGenerator;
+class cmMakefile;
+class cmSourceFile;
 
 class cmOSXBundleGenerator
 {
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 20f2246..d7ad83d 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -12,13 +12,15 @@
 #include "cmOrderDirectories.h"
 
 #include "cmAlgorithms.h"
+#include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
-#include <assert.h>
-
 #include <algorithm>
+#include <assert.h>
+#include <functional>
+#include <sstream>
 
 /*
 Directory ordering computation.
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index 13823a1..081e8a0 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -14,14 +14,16 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
 #include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
 
+class cmGeneratorTarget;
 class cmGlobalGenerator;
 class cmOrderDirectoriesConstraint;
-class cmOrderDirectoriesConstraintLibrary;
-class cmGeneratorTarget;
 
 /** \class cmOrderDirectories
  * \brief Compute a safe runtime path order for a set of shared libraries.
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 630da42..d44fbb7 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -12,14 +12,14 @@
 #include "cmOutputConverter.h"
 
 #include "cmAlgorithms.h"
-#include "cmake.h"
+#include "cmSystemTools.h"
 
+#include <algorithm>
 #include <assert.h>
+#include <ctype.h>
+#include <set>
 #include <sstream>
 
-#include <ctype.h>  /* isalpha */
-#include <string.h> /* strlen */
-
 cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot)
   : StateSnapshot(snapshot)
   , LinkScriptShell(false)
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 02468c8..ac58ddc 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -12,13 +12,13 @@
 #ifndef cmOutputConverter_h
 #define cmOutputConverter_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
-
-#include "cmGlobalGenerator.h"
 #include "cmState.h"
 
+#include <string>
+#include <vector>
+
 class cmOutputConverter
 {
 public:
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index f1da4d5..00f1370 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -13,19 +13,40 @@
 
 #include "cmQtAutoGeneratorInitializer.h"
 
+#include "cmAlgorithms.h"
+#include "cmCustomCommandLines.h"
 #include "cmFilePathUuid.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmOutputConverter.h"
 #include "cmSourceFile.h"
-
-#include <sys/stat.h>
-
-#include <cmsys/FStream.hxx>
+#include "cmSourceFileLocation.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmake.h"
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #include "cmGlobalVisualStudioGenerator.h"
 #endif
 
+#include <algorithm>
+#include <assert.h>
+#include <cmConfigure.h>
+#include <cmsys/FStream.hxx>
+#include <cmsys/RegularExpression.hxx>
+#include <iostream>
+#include <map>
+#include <set>
+#include <sstream>
+#include <string.h>
+#include <string>
+#include <sys/stat.h>
+#include <utility>
+#include <vector>
+
 static std::string GetAutogenTargetName(cmGeneratorTarget const* target)
 {
   std::string autogenTargetName = target->GetName();
diff --git a/Source/cmQtAutoGeneratorInitializer.h b/Source/cmQtAutoGeneratorInitializer.h
index c5a7aba..fedb388 100644
--- a/Source/cmQtAutoGeneratorInitializer.h
+++ b/Source/cmQtAutoGeneratorInitializer.h
@@ -14,15 +14,8 @@
 #ifndef cmQtAutoGeneratorInitializer_h
 #define cmQtAutoGeneratorInitializer_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
-
-#include <map>
-#include <string>
-#include <vector>
-
-class cmSourceFile;
 class cmGeneratorTarget;
 class cmLocalGenerator;
 
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index a261962..329c742 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -20,14 +20,21 @@
 #include "cmOutputConverter.h"
 #include "cmState.h"
 #include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
 
-#include <sys/stat.h>
-
+#include <algorithm>
 #include <assert.h>
+#include <cmConfigure.h>
 #include <cmsys/FStream.hxx>
+#include <cmsys/RegularExpression.hxx>
 #include <cmsys/Terminal.h>
-
+#include <iostream>
+#include <sstream>
+#include <stdlib.h>
 #include <string.h>
+#include <utility>
+
 #if defined(__APPLE__)
 #include <unistd.h>
 #endif
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index ba439d4..32975c2 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -14,12 +14,11 @@
 #ifndef cmQtAutoGenerators_h
 #define cmQtAutoGenerators_h
 
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
 #include <list>
 #include <map>
+#include <set>
 #include <string>
 #include <vector>
 
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 10d1cda..7f80923 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -14,8 +14,13 @@
 #include "cmAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmVersion.h"
+
+#include <algorithm>
 #include <cmsys/FStream.hxx>
 #include <ctype.h>
+#include <iterator>
+#include <stddef.h>
+#include <utility>
 
 cmRST::cmRST(std::ostream& os, std::string const& docroot)
   : OS(os)
diff --git a/Source/cmRST.h b/Source/cmRST.h
index 895901a..f37af88 100644
--- a/Source/cmRST.h
+++ b/Source/cmRST.h
@@ -12,11 +12,14 @@
 #ifndef _cmRST_h
 #define _cmRST_h
 
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
 
 #include <cmsys/RegularExpression.hxx>
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
 
 /** \class cmRST
  * \brief Perform basic .rst processing for command-line help
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index a000258..1ab70e2 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -13,6 +13,8 @@
 
 #include "cmSystemTools.h"
 
+#include <cmConfigure.h>
+
 cmScriptGenerator::cmScriptGenerator(
   const std::string& config_var,
   std::vector<std::string> const& configurations)
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index 4f4dd9e..abe9a1d 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -12,9 +12,11 @@
 #ifndef cmScriptGenerator_h
 #define cmScriptGenerator_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <ostream>
+#include <string>
+#include <vector>
 
 class cmScriptGeneratorIndent
 {
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 5869a01..3aa4b92 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -11,11 +11,16 @@
 ============================================================================*/
 #include "cmSourceFile.h"
 
+#include "cmCustomCommand.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
+#include "cmProperty.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
+#include <sstream>
+
 cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name)
   : Location(mf, name)
 {
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index a3808f7..2c6d831 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -12,12 +12,16 @@
 #ifndef cmSourceFile_h
 #define cmSourceFile_h
 
-#include "cmSourceFileLocation.h"
+#include <cmConfigure.h>
 
-#include "cmCustomCommand.h"
 #include "cmPropertyMap.h"
+#include "cmSourceFileLocation.h"
+
+#include <string>
+#include <vector>
 
-class cmake;
+class cmCustomCommand;
+class cmMakefile;
 
 /** \class cmSourceFile
  * \brief Represent a class loaded from a makefile.
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 099a6f0..e2a1552 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -11,12 +11,17 @@
 ============================================================================*/
 #include "cmSourceFileLocation.h"
 
+#include <cmConfigure.h>
+
 #include "cmAlgorithms.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
 
-#include "assert.h"
+#include <algorithm>
+#include <assert.h>
+#include <vector>
 
 cmSourceFileLocation::cmSourceFileLocation()
   : Makefile(CM_NULLPTR)
diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h
index d41f2bd..e4e5116 100644
--- a/Source/cmSourceFileLocation.h
+++ b/Source/cmSourceFileLocation.h
@@ -12,9 +12,9 @@
 #ifndef cmSourceFileLocation_h
 #define cmSourceFileLocation_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <string>
 
 class cmMakefile;
 
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index c7f093f..c5e6311 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -14,12 +14,12 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
 #include <cmsys/RegularExpression.hxx>
+#include <set>
+#include <string>
+#include <vector>
 
 class cmSourceFile;
-
 class cmSourceGroupInternals;
 
 /** \class cmSourceGroup
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 21a50cb..be0ee50 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -12,20 +12,7 @@
 #include "cmSystemTools.h"
 
 #include "cmAlgorithms.h"
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#ifdef __QNX__
-#include <malloc.h> /* for malloc/free on QNX */
-#endif
-#include <cmsys/Directory.hxx>
-#include <cmsys/Encoding.hxx>
-#include <cmsys/Glob.hxx>
-#include <cmsys/RegularExpression.hxx>
-#include <cmsys/System.h>
+
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include "cmArchiveWrite.h"
 #include "cmLocale.h"
@@ -34,8 +21,38 @@
 #define __LA_INT64_T la_int64_t
 #endif
 #endif
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+#include "cmCryptoHash.h"
+#endif
+
+#if defined(CMAKE_USE_ELF_PARSER)
+#include "cmELF.h"
+#endif
+
+#if defined(CMAKE_USE_MACH_PARSER)
+#include "cmMachO.h"
+#endif
+
+#include <algorithm>
+#include <assert.h>
+#include <cmsys/Directory.hxx>
+#include <cmsys/Encoding.hxx>
 #include <cmsys/FStream.hxx>
+#include <cmsys/RegularExpression.hxx>
+#include <cmsys/System.h>
+#include <cmsys/SystemTools.hxx>
 #include <cmsys/Terminal.h>
+#include <ctype.h>
+#include <errno.h>
+#include <iostream>
+#include <set>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <time.h>
 
 #if defined(_WIN32)
 #include <windows.h>
@@ -43,33 +60,21 @@
 #include <wincrypt.h>
 #else
 #include <sys/time.h>
-#include <sys/types.h>
-#include <sys/wait.h>
 #include <unistd.h>
 #include <utime.h>
 #endif
 
-#if defined(__APPLE__)
-#include <mach-o/dyld.h>
-#endif
-
-#include <sys/stat.h>
-
 #if defined(_WIN32) &&                                                        \
   (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__MINGW32__))
 #include <io.h>
 #endif
 
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#include "cmCryptoHash.h"
-#endif
-
-#if defined(CMAKE_USE_ELF_PARSER)
-#include "cmELF.h"
+#if defined(__APPLE__)
+#include <mach-o/dyld.h>
 #endif
 
-#if defined(CMAKE_USE_MACH_PARSER)
-#include "cmMachO.h"
+#ifdef __QNX__
+#include <malloc.h> /* for malloc/free on QNX */
 #endif
 
 static bool cm_isspace(char c)
@@ -142,6 +147,7 @@ private:
 };
 #elif defined(__APPLE__)
 #include <crt_externs.h>
+
 #define environ (*_NSGetEnviron())
 #endif
 
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index cfc174e..090c9d6 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -20,6 +20,7 @@
 #include "cmState.h"
 #include "cmSystemTools.h"
 #include "cmTest.h"
+#include "cm_auto_ptr.hxx"
 
 #include <map>
 #include <ostream>
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 701a5e5..25f9e3a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -12,33 +12,33 @@
 #include "cmake.h"
 
 #include "cmAlgorithms.h"
-#include "cmCommand.h"
 #include "cmCommands.h"
+#include "cmDocumentation.h"
+#include "cmDocumentationEntry.h"
 #include "cmDocumentationFormatter.h"
 #include "cmExternalMakefileProjectGenerator.h"
 #include "cmFileTimeComparison.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmMessenger.h"
-#include "cmSourceFile.h"
 #include "cmState.h"
-#include "cmTest.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmTargetLinkLibraryType.h"
 #include "cmUtils.hxx"
-#include "cmVersionMacros.h"
+#include "cmVersionConfig.h"
+#include "cm_auto_ptr.hxx"
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include "cmGraphVizWriter.h"
 #include "cmVariableWatch.h"
-#include <cmsys/SystemInformation.hxx>
-
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
+#include <cm_jsoncpp_value.h>
+#include <cm_jsoncpp_writer.h>
 #endif
 
-#include <cmsys/FStream.hxx>
-#include <cmsys/Glob.hxx>
-#include <cmsys/RegularExpression.hxx>
-
 // only build kdevelop generator on non-windows platforms
 // when not bootstrapping cmake
 #if !defined(_WIN32)
@@ -69,6 +69,7 @@
 #include "cmGlobalVisualStudio71Generator.h"
 #include "cmGlobalVisualStudio8Generator.h"
 #include "cmGlobalVisualStudio9Generator.h"
+
 #define CMAKE_HAVE_VS_GENERATORS
 #endif
 #include "cmGlobalMSYSMakefileGenerator.h"
@@ -98,11 +99,10 @@
 #include "cmExtraEclipseCDT4Generator.h"
 #endif
 
-#include <stdlib.h> // required for atoi
-
 #if defined(__APPLE__)
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include "cmGlobalXCodeGenerator.h"
+
 #define CMAKE_USE_XCODE 1
 #endif
 #include <sys/resource.h>
@@ -113,7 +113,18 @@
 // include sys/stat.h after sys/types.h
 #include <sys/stat.h> // struct stat
 
-#include <list>
+#include <algorithm>
+#include <cmsys/FStream.hxx>
+#include <cmsys/Glob.hxx>
+#include <cmsys/RegularExpression.hxx>
+#include <iostream>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <utility>
+
+class cmCommand;
 
 namespace {
 
diff --git a/Source/cmake.h b/Source/cmake.h
index 91a23cd..9dc429d 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -15,25 +15,23 @@
 
 #include <cmConfigure.h>
 
-#include "cmStandardIncludes.h"
-
-#include "cmCacheManager.h"
 #include "cmInstalledFile.h"
 #include "cmListFileCache.h"
 #include "cmState.h"
-#include "cmSystemTools.h"
 
-class cmGlobalGeneratorFactory;
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+class cmExternalMakefileProjectGeneratorFactory;
+class cmFileTimeComparison;
 class cmGlobalGenerator;
-class cmLocalGenerator;
+class cmGlobalGeneratorFactory;
 class cmMakefile;
 class cmMessenger;
 class cmVariableWatch;
-class cmFileTimeComparison;
-class cmExternalMakefileProjectGeneratorFactory;
-class cmDocumentationSection;
-class cmTarget;
-class cmGeneratedFileStream;
+struct cmDocumentationEntry;
 
 /** \brief Represents a cmake invocation.
  *
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index db6d51b..1450949 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -17,18 +17,23 @@
 #endif
 
 #include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
 #include "cmGlobalGenerator.h"
-#include "cmListFileCache.h"
-#include "cmLocalGenerator.h"
 #include "cmMakefile.h"
-#include "cmSourceFile.h"
 #include "cmState.h"
+#include "cmSystemTools.h"
 #include "cmake.h"
 #include "cmcmd.h"
+
+#include <cmConfigure.h>
 #include <cmsys/Encoding.hxx>
+#include <iostream>
+#include <string.h>
+#include <string>
+#include <vector>
 
 #ifdef CMAKE_USE_LIBUV
-#include "cm_uv.h"
+#include <cm_uv.h>
 #endif
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index f25c085..c2e1d53 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -16,29 +16,37 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmQtAutoGenerators.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
 #include "cmUtils.hxx"
 #include "cmVersion.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
 #endif
 
-#include <cmsys/Directory.hxx>
-#include <cmsys/FStream.hxx>
-#include <cmsys/Process.h>
-#include <cmsys/Terminal.h>
+#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32)
+#include "bindexplib.h"
+#endif
 
 #if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) && !defined(__CYGWIN__)
 #include "cmVisualStudioWCEPlatformParser.h"
 #endif
 
+#include <algorithm>
+#include <cmConfigure.h>
+#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
+#include <cmsys/Process.h>
+#include <cmsys/Terminal.h>
+#include <iostream>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
 #include <time.h>
 
-#include <stdlib.h> // required for atoi
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
-#include "bindexplib.h"
-#endif
-
 void CMakeCommandUsage(const char* program)
 {
   std::ostringstream errorStream;
diff --git a/Source/cmcmd.h b/Source/cmcmd.h
index 1096d0c..cd6222d 100644
--- a/Source/cmcmd.h
+++ b/Source/cmcmd.h
@@ -13,9 +13,10 @@
 #ifndef cmcmd_h
 #define cmcmd_h
 
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmStandardIncludes.h"
+#include <string>
+#include <vector>
 
 class cmcmd
 {
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 38ff64f..93a6ebb 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -9,16 +9,21 @@
   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   See the License for more information.
 ============================================================================*/
-#include "cmCTest.h"
-#include "cmSystemTools.h"
 
-// Need these for documentation support.
-#include "cmDocumentation.h"
-#include "cmake.h"
+#include <cmConfigure.h>
 
 #include "CTest/cmCTestLaunch.h"
 #include "CTest/cmCTestScriptHandler.h"
-#include "cmsys/Encoding.hxx"
+#include "cmCTest.h"
+#include "cmDocumentation.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+#include <cmsys/Encoding.hxx>
+#include <iostream>
+#include <string.h>
+#include <string>
+#include <vector>
 
 static const char* cmDocumentationName[][2] = {
   { CM_NULLPTR, "  ctest - Testing driver provided by CMake." },
-- 
cgit v0.12