diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 1ab4ef6ac8fee037e025dad145b2b3d4876e5d43..620de31d33677bc978da37e54c9abdec5578e603 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -2,11 +2,19 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmAddCustomCommandCommand.h"
 
-#include "cmTarget.h"
+#include <sstream>
 
+#include "cmCustomCommand.h"
+#include "cmCustomCommandLines.h"
+#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
 #include "cmSourceFile.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmake.h"
 
-#include "cmGlobalGenerator.h"
+class cmExecutionStatus;
 
 // cmAddCustomCommandCommand
 bool cmAddCustomCommandCommand::InitialPass(
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 643163c7af1ddae9b197615c1e50fe83314883cc..ea921630b730c0a3c76a46aed91ad5ce2617454d 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmAddCustomCommandCommand_h
 #define cmAddCustomCommandCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmAddCustomCommandCommand
  * \brief cmAddCustomCommandCommand defines a new command (rule) that can
  *  be executed within the build process
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 9c41dac2ae70882458d835c392511dd35ceb35b7..4e656aa6fc90458fbfc84421e28cf976fa215c00 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -2,8 +2,18 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmAddCustomTargetCommand.h"
 
+#include <sstream>
+
+#include "cmCustomCommandLines.h"
 #include "cmGeneratorExpression.h"
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmAddCustomTargetCommand
 bool cmAddCustomTargetCommand::InitialPass(
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index 2ad244c57457086491ae10056f4cad9c4c0c20d8..b6792472fefcda9789b308ace6193d333bdeb4d8 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmAddCustomTargetCommand_h
 #define cmAddCustomTargetCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmAddCustomTargetCommand
  * \brief Command that adds a target to the build system.
  *
diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx
index 8d82e71a79297e2567a2c613c47451e09680ed95..9e0607c60eef79fdd435777cc42acd9a9c2aae95 100644
--- a/Source/cmAddDefinitionsCommand.cxx
+++ b/Source/cmAddDefinitionsCommand.cxx
@@ -2,6 +2,10 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmAddDefinitionsCommand.h"
 
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
 // cmAddDefinitionsCommand
 bool cmAddDefinitionsCommand::InitialPass(std::vector<std::string> const& args,
                                           cmExecutionStatus&)
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index c6b56992e0f53d46f1b6b77e944cf25863d15b79..735f8cc1e0a85ed60f140a7a85a8314e47f6705c 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmAddDefinitionsCommand_h
 #define cmAddDefinitionsCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmAddDefinitionsCommand
  * \brief Specify a list of compiler defines
  *
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index 0fa89433a94b1681cb3b7382efee140a58f83248..e49d5d5d90078269e1511f29cddfcbb4404d2c1c 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -2,7 +2,13 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmAddDependenciesCommand.h"
 
-#include "cmGlobalGenerator.h"
+#include <sstream>
+
+#include "cmMakefile.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmDependenciesCommand
 bool cmAddDependenciesCommand::InitialPass(
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index 2c7aa02cd22079db6e85db967218ea890e1f911c..8be546c6c44d824eedd4a91575ce5254185e946c 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmDependenciessCommand_h
 #define cmDependenciessCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmAddDependenciesCommand
  * \brief Add a dependency to a target
  *
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 3d0729b8e07d5193c5dc9556c9afd0d54fe2baf9..2a0bb15307adfde7200d95a06bb86e0529fcf291 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -2,7 +2,17 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmAddExecutableCommand.h"
 
+#include <sstream>
+
+#include "cmGeneratorExpression.h"
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmStateTypes.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmExecutableCommand
 bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index 03faaf10b443e7de637836216f82e1453e855d7a..62583d8951e889f9688b1d0b31f8747b34af5fe8 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmExecutablesCommand_h
 #define cmExecutablesCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmExecutablesCommand
  * \brief Defines a list of executables to build.
  *
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 56cf91ae4b192a02367fc95fc432b6eb22e29bff..5c9c7443614fd92ef8de9fc629e3d0e3a7ec02d6 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -2,12 +2,20 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmAddLibraryCommand.h"
 
+#include <sstream>
+
+#include "cmGeneratorExpression.h"
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
 #include "cmState.h"
 #include "cmStateTypes.h"
 #include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmake.h"
 
+class cmExecutionStatus;
+
 // cmLibraryCommand
 bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
                                       cmExecutionStatus&)
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index d8eba8dc916136cdaf896371e93059883d1601e8..c23b2998fded1dc1593dcc8595d6c0e041e02b57 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmLibrarysCommand_h
 #define cmLibrarysCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmLibrarysCommand
  * \brief Defines a list of executables to build.
  *
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 0ebe35d54bd9a7d1160fc3a3eaf6207ac435562f..34ec0e35e62004b51680eed6c86c138d6a209f60 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -2,8 +2,14 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmAddSubDirectoryCommand.h"
 
+#include <sstream>
+#include <string.h>
+
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmAddSubDirectoryCommand
 bool cmAddSubDirectoryCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index f300b2e1c649b5a3f51f72a9beb55f6c872154fe..85305e6d05740c88eee382c91beaeffa974bfda9 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmAddSubDirectoryCommand_h
 #define cmAddSubDirectoryCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmAddSubDirectoryCommand
  * \brief Specify a subdirectory to build
  *
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 11342eebb57d54cfea7c012fbf73d3deb5649e43..3a3afdb052dfaec78e653b84d794959d370715ad 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -2,9 +2,13 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmAddTestCommand.h"
 
-#include "cmTestGenerator.h"
+#include <sstream>
 
+#include "cmMakefile.h"
 #include "cmTest.h"
+#include "cmTestGenerator.h"
+
+class cmExecutionStatus;
 
 // cmExecutableCommand
 bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 7bbf7cf1c7142acc93e1ade9739ba7759dfaae37..07eff6866b8beb12d98ee29945aa086814e6fd72 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmAddTestCommand_h
 #define cmAddTestCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmAddTestCommand
  * \brief Add a test to the lists of tests to run.
  *
diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx
index a5b6e84721ab6c8186b4863dbc2da6db2c0573eb..9bb6137c864902f448a05d164614528d7976c9c2 100644
--- a/Source/cmBreakCommand.cxx
+++ b/Source/cmBreakCommand.cxx
@@ -2,7 +2,12 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmBreakCommand.h"
 
+#include <sstream>
+
 #include "cmExecutionStatus.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmake.h"
 
 // cmBreakCommand
 bool cmBreakCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index f1ade9a1eae05b9b2588fa73f041ca7899c99cd0..5113e180dc3fef545364d5f13318d313c7c72375 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmBreakCommand_h
 #define cmBreakCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmBreakCommand
  * \brief Break from an enclosing foreach or while loop
  *
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 8aa41020879ddc182f2eb4c3ce54f7ae99488df3..d03b8c4bafc8bad0ea10665ff030bed7809629b8 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -2,7 +2,15 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmBuildCommand.h"
 
+#include <sstream>
+
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmStateTypes.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 bool cmBuildCommand::InitialPass(std::vector<std::string> const& args,
                                  cmExecutionStatus&)
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index 0dce4e4aaf776552298ec29c98c1c4b154864ebf..62f1fd3b5dd07ffff3c0831884e3428973ec5d1c 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmBuildCommand_h
 #define cmBuildCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmBuildCommand
  * \brief build_command command
  *
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 3257c93915c9c95826ece14c9e5115589a057dd5..1e1cd21210a6f965b4dd6330f8724b4716def48a 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -7,7 +7,7 @@
 
 #include "cmMakefile.h"
 #include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
 class cmExecutionStatus;
diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx
index d71172c860a64f3707c2e903fd9c0ec6d68c8870..655c42aa907928ebd733c21308e3ab02dedcfa2e 100644
--- a/Source/cmCMakeMinimumRequired.cxx
+++ b/Source/cmCMakeMinimumRequired.cxx
@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCMakeMinimumRequired.h"
 
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 #include "cmVersion.h"
 
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index 67581b6a09d71cd878a02cbc45a7a2161bdcb4dc..3ccc815e684f15ecc124571929652c411359ba94 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -2,8 +2,15 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCMakePolicyCommand.h"
 
+#include <sstream>
+
+#include "cmMakefile.h"
+#include "cmPolicies.h"
 #include "cmState.h"
-#include "cmVersion.h"
+#include "cmStateTypes.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmCMakePolicyCommand
 bool cmCMakePolicyCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index 68d9f7ba0c3d4d164d7b024b43af7f7171702582..409fc59be12b38e1ce13be23ff68be98e0566702 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmCMakePolicyCommand_h
 #define cmCMakePolicyCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmCMakePolicyCommand
  * \brief Set how CMake should handle policies
  *
diff --git a/Source/cmCommand.cxx b/Source/cmCommand.cxx
index 3c839de859015bb59bab5f4b8b6f49409848e7d2..181b412661f8b0377469abf65c6e963c15d3c05e 100644
--- a/Source/cmCommand.cxx
+++ b/Source/cmCommand.cxx
@@ -2,6 +2,12 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCommand.h"
 
+#include "cmMakefile.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
+struct cmListFileArgument;
+
 bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
                                   cmExecutionStatus& status)
 {
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index dcfe8da137d5a990e9080d449c0a4f5ec0f59a2d..d9fd5a286d8bc1ad2e2bc1fa7a55b02dd1b24828 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -3,9 +3,16 @@
 #ifndef cmCommand_h
 #define cmCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommandArgumentsHelper.h"
-#include "cmListFileCache.h"
-#include "cmMakefile.h"
+#include "cmPolicies.h"
+
+class cmExecutionStatus;
+class cmMakefile;
+struct cmListFileArgument;
 
 /** \class cmCommand
  * \brief Superclass for all commands in CMake.
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 0697d4b7397772fde112b1f6f57240813ec06e64..103e72cfc4afbc64088fe6cd9f09b23f6c6164b7 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -14,11 +14,8 @@
 #include "cmBuildCommand.h"
 #include "cmCMakeMinimumRequired.h"
 #include "cmCMakePolicyCommand.h"
-#include "cmCommandArgumentsHelper.h"
-#include "cmConditionEvaluator.h"
 #include "cmConfigureFileCommand.h"
 #include "cmContinueCommand.h"
-#include "cmCoreTryCompile.h"
 #include "cmCreateTestSourceList.h"
 #include "cmDefinePropertyCommand.h"
 #include "cmElseCommand.h"
@@ -31,10 +28,7 @@
 #include "cmEndWhileCommand.h"
 #include "cmExecProgramCommand.h"
 #include "cmExecuteProcessCommand.h"
-#include "cmExpandedCommandArgument.h"
 #include "cmFileCommand.h"
-#include "cmFindBase.h"
-#include "cmFindCommon.h"
 #include "cmFindFileCommand.h"
 #include "cmFindLibraryCommand.h"
 #include "cmFindPackageCommand.h"
@@ -49,13 +43,11 @@
 #include "cmGetSourceFilePropertyCommand.h"
 #include "cmGetTargetPropertyCommand.h"
 #include "cmGetTestPropertyCommand.h"
-#include "cmHexFileConverter.h"
 #include "cmIfCommand.h"
 #include "cmIncludeCommand.h"
 #include "cmIncludeDirectoryCommand.h"
 #include "cmIncludeRegularExpressionCommand.h"
 #include "cmInstallCommand.h"
-#include "cmInstallCommandArguments.h"
 #include "cmInstallFilesCommand.h"
 #include "cmInstallTargetsCommand.h"
 #include "cmLinkDirectoriesCommand.h"
@@ -67,10 +59,8 @@
 #include "cmMessageCommand.h"
 #include "cmOptionCommand.h"
 #include "cmParseArgumentsCommand.h"
-#include "cmPathLabel.h"
 #include "cmProjectCommand.h"
 #include "cmReturnCommand.h"
-#include "cmSearchPath.h"
 #include "cmSeparateArgumentsCommand.h"
 #include "cmSetCommand.h"
 #include "cmSetDirectoryPropertiesCommand.h"
@@ -82,7 +72,6 @@
 #include "cmStringCommand.h"
 #include "cmSubdirCommand.h"
 #include "cmTargetLinkLibrariesCommand.h"
-#include "cmTimestamp.h"
 #include "cmTryCompileCommand.h"
 #include "cmTryRunCommand.h"
 #include "cmUnsetCommand.h"
@@ -113,7 +102,6 @@
 #include "cmTargetCompileFeaturesCommand.h"
 #include "cmTargetCompileOptionsCommand.h"
 #include "cmTargetIncludeDirectoriesCommand.h"
-#include "cmTargetPropCommandBase.h"
 #include "cmTargetSourcesCommand.h"
 #include "cmUseMangledMesaCommand.h"
 #include "cmUtilitySourceCommand.h"
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 7d98e737b7a00f4dad0584b568749c21da43af36..71d6c4ea0c2f8a724d0cb6f5c271ac1479f7ba6a 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -3,6 +3,7 @@
 #include "cmConditionEvaluator.h"
 
 #include "cmAlgorithms.h"
+#include "cmMakefile.h"
 #include "cmOutputConverter.h"
 #include "cmState.h"
 #include "cmSystemTools.h"
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
index 306bee44149b3dd33ff91c5de24f4984529ae947..3c9d2cda9fe8e5c7f86a552d3266f5953c380f40 100644
--- a/Source/cmConditionEvaluator.h
+++ b/Source/cmConditionEvaluator.h
@@ -5,6 +5,8 @@
 
 #include "cmCommand.h"
 #include "cmExpandedCommandArgument.h"
+#include "cmListFileCache.h"
+#include "cmake.h"
 
 #include <list>
 
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index 0755dceb7db7cebb8cfe561541018f2a246b480f..b9c75497a82401884749722f9d8d6515ba61b8b8 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -2,9 +2,13 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmConfigureFileCommand.h"
 
+#include <sstream>
+
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
 
-#include <cmsys/RegularExpression.hxx>
+class cmExecutionStatus;
 
 // cmConfigureFileCommand
 bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 9df4550f020a63ad3e4c901f767ad264317374e0..e558b85ff23c5ba890138ad72a6a32706116ec1a 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -3,7 +3,14 @@
 #ifndef cmConfigureFileCommand_h
 #define cmConfigureFileCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
+#include "cmNewLineStyle.h"
+
+class cmExecutionStatus;
 
 class cmConfigureFileCommand : public cmCommand
 {
diff --git a/Source/cmContinueCommand.cxx b/Source/cmContinueCommand.cxx
index dc3e02c99dfb65896960c4e7e08525b7e739a0c3..53d035db8976f758ad0948205780f8997921c4c6 100644
--- a/Source/cmContinueCommand.cxx
+++ b/Source/cmContinueCommand.cxx
@@ -3,7 +3,9 @@
 #include "cmContinueCommand.h"
 
 #include "cmExecutionStatus.h"
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
 
 // cmContinueCommand
 bool cmContinueCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index 0c4e650e624405b1513f7b4681330ca07501396c..c5b8919370b995bcb44ce26df2d8cca99df268ae 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmContinueCommand_h
 #define cmContinueCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmContinueCommand
  * \brief Continue from an enclosing foreach or while loop
  *
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index c7b6d5879176449057c92f66b1eeb5f2936b3386..a1de0749044eb37e8ea422165955d5bada3a56a9 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -5,6 +5,7 @@
 #include "cmAlgorithms.h"
 #include "cmExportTryCompileFileGenerator.h"
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
 #include "cmOutputConverter.h"
 #include "cmState.h"
 #include "cmake.h"
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index 5f909dd272c5c9cd826bd5565572f0b0760b5199..0d9bb7921b48d69d69d800380976f73493e8eab7 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -4,6 +4,7 @@
 #define cmCoreTryCompile_h
 
 #include "cmCommand.h"
+#include "cmStateTypes.h"
 
 /** \class cmCoreTryCompile
  * \brief Base class for cmTryCompileCommand and cmTryRunCommand
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index b062d4d9f6146ca2a13a8ed3dd44dec0dcc7c620..14a6c88c86452521a9f55575a52dd7c0a0901ae6 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCreateTestSourceList.h"
 
+#include "cmMakefile.h"
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
 
diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx
index af4eff9fc35e62a660e23b7b014118cfc5bf5336..9a097f3d80108782c509209ff85c03e2ba872fd7 100644
--- a/Source/cmDefinePropertyCommand.cxx
+++ b/Source/cmDefinePropertyCommand.cxx
@@ -2,9 +2,13 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmDefinePropertyCommand.h"
 
+#include <sstream>
+
+#include "cmMakefile.h"
+#include "cmProperty.h"
 #include "cmState.h"
-#include "cmStateTypes.h"
-#include "cmake.h"
+
+class cmExecutionStatus;
 
 bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,
                                           cmExecutionStatus&)
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index cdfff9f5212331f9015ad8ef5c08b49fbef39b97..02e5b883fc6217d027b383fde71d2c0b56f8746d 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmDefinesPropertyCommand_h
 #define cmDefinesPropertyCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 class cmDefinePropertyCommand : public cmCommand
 {
 public:
diff --git a/Source/cmElseCommand.cxx b/Source/cmElseCommand.cxx
index 16e53f6b1c1cf00e60cc4a67ad0cece74604f1fc..207777e1d87dfbb4559f718a4aa09d6001e40306 100644
--- a/Source/cmElseCommand.cxx
+++ b/Source/cmElseCommand.cxx
@@ -2,6 +2,8 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmElseCommand.h"
 
+class cmExecutionStatus;
+
 bool cmElseCommand::InitialPass(std::vector<std::string> const&,
                                 cmExecutionStatus&)
 {
diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h
index 32e04a7c4ce056b924153dd32503c5f9fbc04257..c0162add8cec8d41005961d286ef1ddee5d21771 100644
--- a/Source/cmElseCommand.h
+++ b/Source/cmElseCommand.h
@@ -3,7 +3,13 @@
 #ifndef cmElseCommand_h
 #define cmElseCommand_h
 
-#include "cmIfCommand.h"
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
+#include "cmCommand.h"
+
+class cmExecutionStatus;
 
 /** \class cmElseCommand
  * \brief ends an if block
diff --git a/Source/cmEnableLanguageCommand.cxx b/Source/cmEnableLanguageCommand.cxx
index 49fd6fdbc88c8e2626fe72c1da4c2a4d8fbf5552..c57b7b15ce8974aa6a4cb61e375dd9442973aec2 100644
--- a/Source/cmEnableLanguageCommand.cxx
+++ b/Source/cmEnableLanguageCommand.cxx
@@ -2,6 +2,10 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmEnableLanguageCommand.h"
 
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
 // cmEnableLanguageCommand
 bool cmEnableLanguageCommand::InitialPass(std::vector<std::string> const& args,
                                           cmExecutionStatus&)
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index 34e1d3d66b2dccedc9e64fddbae0480900937724..bafb79e832e082823a521ce20eac8df66a9a4fb6 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmEnableLanguageCommand_h
 #define cmEnableLanguageCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmEnableLanguageCommand
  * \brief Specify the name for this build project.
  *
diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx
index d66c5b355536b75ee0b1a17c5f7db8843237ee7d..6a64450f5556d64009a73f21034f39d851ed8c17 100644
--- a/Source/cmEnableTestingCommand.cxx
+++ b/Source/cmEnableTestingCommand.cxx
@@ -2,6 +2,10 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmEnableTestingCommand.h"
 
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
 // we do this in the final pass so that we now the subdirs have all
 // been defined
 bool cmEnableTestingCommand::InitialPass(std::vector<std::string> const&,
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index b94967adbf4506f9536ec6a9fbc5a0b1cd1e4750..67cd237bbf8225356929799fe291cab3e1b3c34a 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmEnableTestingCommand_h
 #define cmEnableTestingCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmEnableTestingCommand
  * \brief Enable testing for this directory and below.
  *
diff --git a/Source/cmEndForEachCommand.cxx b/Source/cmEndForEachCommand.cxx
index 7184bae506485f193de01454d6d6859af0d31e93..fe6a7f352fdd8e6762764be728454c49ac38bf0a 100644
--- a/Source/cmEndForEachCommand.cxx
+++ b/Source/cmEndForEachCommand.cxx
@@ -2,6 +2,9 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmEndForEachCommand.h"
 
+class cmExecutionStatus;
+struct cmListFileArgument;
+
 bool cmEndForEachCommand::InvokeInitialPass(
   std::vector<cmListFileArgument> const&, cmExecutionStatus&)
 {
diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h
index a146e4d46d907da592b7ba7aa301269aa8cb19b2..772a1395e0a18d68f856ffa2d722ce9c5b446fc1 100644
--- a/Source/cmEndForEachCommand.h
+++ b/Source/cmEndForEachCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmEndForEachCommand_h
 #define cmEndForEachCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+struct cmListFileArgument;
+
 /** \class cmEndForEachCommand
  * \brief ends an if block
  *
diff --git a/Source/cmEndFunctionCommand.cxx b/Source/cmEndFunctionCommand.cxx
index 82344c6801fd1f37d6ec01b3a50835f8f22bab51..6adb42b1eaccea5e01556bd06e129316d08fbd7d 100644
--- a/Source/cmEndFunctionCommand.cxx
+++ b/Source/cmEndFunctionCommand.cxx
@@ -2,6 +2,9 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmEndFunctionCommand.h"
 
+class cmExecutionStatus;
+struct cmListFileArgument;
+
 bool cmEndFunctionCommand::InvokeInitialPass(
   std::vector<cmListFileArgument> const&, cmExecutionStatus&)
 {
diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h
index ab174fd886f6de9b7a8592d7b2aeab4d8b9a2bda..2599637bb9acaa082f402304c068ff8ed4df5509 100644
--- a/Source/cmEndFunctionCommand.h
+++ b/Source/cmEndFunctionCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmEndFunctionCommand_h
 #define cmEndFunctionCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+struct cmListFileArgument;
+
 /** \class cmEndFunctionCommand
  * \brief ends an if block
  *
diff --git a/Source/cmEndIfCommand.cxx b/Source/cmEndIfCommand.cxx
index 78a0d0f936743152033e0ab84a46a28ae32cc306..50c2b42dc2df5fefab23c324f7c6197c83407d0a 100644
--- a/Source/cmEndIfCommand.cxx
+++ b/Source/cmEndIfCommand.cxx
@@ -3,6 +3,11 @@
 #include "cmEndIfCommand.h"
 
 #include <stdlib.h> // required for atof
+
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
 bool cmEndIfCommand::InitialPass(std::vector<std::string> const&,
                                  cmExecutionStatus&)
 {
diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h
index d068bb409f965d96908b4ef6619cb779d7f345d0..dfd60490ff154b120dd1fa8839823a456d062990 100644
--- a/Source/cmEndIfCommand.h
+++ b/Source/cmEndIfCommand.h
@@ -3,7 +3,13 @@
 #ifndef cmEndIfCommand_h
 #define cmEndIfCommand_h
 
-#include "cmIfCommand.h"
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
+#include "cmCommand.h"
+
+class cmExecutionStatus;
 
 /** \class cmEndIfCommand
  * \brief ends an if block
diff --git a/Source/cmEndMacroCommand.cxx b/Source/cmEndMacroCommand.cxx
index 189d9692e58a8e07912903547ecda900760d2ba5..046b0af086f70da28b24915daf3ade1073d45856 100644
--- a/Source/cmEndMacroCommand.cxx
+++ b/Source/cmEndMacroCommand.cxx
@@ -2,6 +2,9 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmEndMacroCommand.h"
 
+class cmExecutionStatus;
+struct cmListFileArgument;
+
 bool cmEndMacroCommand::InvokeInitialPass(
   std::vector<cmListFileArgument> const&, cmExecutionStatus&)
 {
diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h
index 34ae880b3616674ca64c79ce3f41bebc50787543..3c462d458f91425b6e2c38ab143ddc67391f5e77 100644
--- a/Source/cmEndMacroCommand.h
+++ b/Source/cmEndMacroCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmEndMacroCommand_h
 #define cmEndMacroCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+struct cmListFileArgument;
+
 /** \class cmEndMacroCommand
  * \brief ends an if block
  *
diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx
index b635168179872cf3d9a1fe68e116cd18c37a4670..5623f332990f6be42e07c134d8d46d8ff3a87902 100644
--- a/Source/cmEndWhileCommand.cxx
+++ b/Source/cmEndWhileCommand.cxx
@@ -2,6 +2,10 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmEndWhileCommand.h"
 
+#include "cmListFileCache.h"
+
+class cmExecutionStatus;
+
 bool cmEndWhileCommand::InvokeInitialPass(
   std::vector<cmListFileArgument> const& args, cmExecutionStatus&)
 {
diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h
index 23667060f88184f74fbc3732333beb673a0eca1d..d4e97b4e7390d09a0b198795f316b576f4aaa161 100644
--- a/Source/cmEndWhileCommand.h
+++ b/Source/cmEndWhileCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmEndWhileCommand_h
 #define cmEndWhileCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+struct cmListFileArgument;
+
 /** \class cmEndWhileCommand
  * \brief ends a while loop
  *
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index a3d68520bcb788470f934ab28788514cb1e5031a..df92592aaa069127b843fbbdd64e9c9ba38b3acf 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -2,9 +2,13 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmExecProgramCommand.h"
 
+#include <cmsys/Process.h>
+#include <stdio.h>
+
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
-#include <cmsys/Process.h>
+class cmExecutionStatus;
 
 // cmExecProgramCommand
 bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index a3e96ae89ff68e406115cc1f7324ffa6fd330fb8..7cdf77739f2a84f27752a9a4d1a72fd8c04d37b9 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmExecProgramCommand_h
 #define cmExecProgramCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmExecProgramCommand
  * \brief Command that adds a target to the build system.
  *
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 2bcf2441e6c0c9e3133f60eddd45bf690e322712..c8a3a84846e87b91f9b6cc3470c487d16fb7b3b2 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -2,11 +2,15 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmExecuteProcessCommand.h"
 
-#include "cmSystemTools.h"
-
 #include <cmsys/Process.h>
-
 #include <ctype.h> /* isspace */
+#include <sstream>
+#include <stdio.h>
+
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
+class cmExecutionStatus;
 
 static bool cmExecuteProcessCommandIsWhitespace(char c)
 {
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index 22429986b56f974a17b3fc1947a84222504ffc79..9ce4338c6c00cdc1f4f9dfc04045782749ee14a5 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmExecuteProcessCommand_h
 #define cmExecuteProcessCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmExecuteProcessCommand
  * \brief Command that adds a target to the build system.
  *
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index c9dac352d6aba5df3baf82d41aef7f6b66184be6..810227689e718c72a590a8f0f0146ffbcb95a3f2 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -12,7 +12,7 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmake.h"
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index bf1ea012b6f0885b98045984e2413c03a0540178..f556a8b523862a492a0b1fb05d5b8b0ce07e6929 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -2,17 +2,20 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmExportLibraryDependenciesCommand.h"
 
-#include <cm_auto_ptr.hxx>
 #include <cmsys/FStream.hxx>
+#include <map>
+#include <utility>
 
 #include "cmGeneratedFileStream.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTargetLinkLibraryType.h"
+#include "cm_auto_ptr.hxx"
+#include "cm_unordered_map.hxx"
 #include "cmake.h"
 
 class cmExecutionStatus;
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 6b5870b08a3320bbfad57114eb0047ce51dbd6ed..6285894550b756cffe5c64729b6500866b147c8d 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -9,9 +9,9 @@
 #include "cmGlobalGenerator.h"
 #include "cmHexFileConverter.h"
 #include "cmInstallType.h"
-#include "cmake.h"
-
+#include "cmMakefile.h"
 #include "cmTimestamp.h"
+#include "cmake.h"
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include "cmCurl.h"
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index b53bae83264ef10a8feb7d48c6d1f303036654db..319864c8735a4dc9ba2fe21ef62ed5ecc7adce6b 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -3,9 +3,13 @@
 #ifndef cmFileCommand_h
 #define cmFileCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
-struct cmFileInstaller;
+class cmExecutionStatus;
 
 /** \class cmFileCommand
  * \brief Command for manipulation of files
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 118c58121b29599a491d64479cf2ea268ccfd28c..3d67ac102acd7900d63427f3d2376df3a3c4aee5 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -3,6 +3,7 @@
 #include "cmFindBase.h"
 
 #include "cmAlgorithms.h"
+#include "cmMakefile.h"
 #include "cmState.h"
 #include "cmStateTypes.h"
 #include "cmSystemTools.h"
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index bc175ff2d372dd55dfb261dff41b3bf12641ce3b..75d1453d6cc55ce77c639da556c9e4fc58eb0b4b 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmFindCommon.h"
 
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
 #include <algorithm>
diff --git a/Source/cmFindFileCommand.cxx b/Source/cmFindFileCommand.cxx
index 9c66cd2c5045019d3d88bee8f1e0ed8a9eeb7ed6..9840c4f499c06451a8a62b992a688d0fdb216600 100644
--- a/Source/cmFindFileCommand.cxx
+++ b/Source/cmFindFileCommand.cxx
@@ -2,8 +2,6 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmFindFileCommand.h"
 
-#include "cmSystemTools.h"
-
 cmFindFileCommand::cmFindFileCommand()
 {
   this->IncludeFileInPath = true;
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index e121784a5f0c6021bf19fd1ef891274b28afdc8a..5c94ebf237610ea3e413133623b91e8210e7e6cd 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -3,8 +3,13 @@
 #ifndef cmFindFileCommand_h
 #define cmFindFileCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+
 #include "cmFindPathCommand.h"
 
+class cmCommand;
+
 /** \class cmFindFileCommand
  * \brief Define a command to search for an executable program.
  *
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 56be0cba74e75a07c317f33f684c90aa5750b198..2feedf3ff4227972a54f3adbdd6b1fa52a7628bd 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -2,12 +2,19 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmFindLibraryCommand.h"
 
+#include <algorithm>
+#include <cmsys/RegularExpression.hxx>
+#include <set>
+#include <stdio.h>
+#include <string.h>
+
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
-#include "cmVersion.h"
 
-#include <cmsys/Directory.hxx>
+class cmExecutionStatus;
 
 cmFindLibraryCommand::cmFindLibraryCommand()
 {
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index 8531e514fb4b2e9bd99ae0775da8619e979aa546..aeff62971b457030bd5834b075a521ec703af109 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmFindLibraryCommand_h
 #define cmFindLibraryCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmFindBase.h"
 
+class cmCommand;
+class cmExecutionStatus;
+
 /** \class cmFindLibraryCommand
  * \brief Define a command to search for a library.
  *
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 373b728be4828bc054295135063919302c402928..60de74f416ef285ff5a2c179405611993b94b78a 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -2,26 +2,38 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmFindPackageCommand.h"
 
-#include "cmAlgorithms.h"
-#include "cmState.h"
-#include "cmVersion.h"
-
+#include <algorithm>
+#include <assert.h>
 #include <cmSystemTools.h>
 #include <cmsys/Directory.hxx>
-#include <cmsys/Encoding.hxx>
 #include <cmsys/FStream.hxx>
+#include <cmsys/Glob.hxx>
 #include <cmsys/RegularExpression.hxx>
+#include <cmsys/String.h>
+#include <functional>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
+#include <string.h>
+#include <utility>
 
-#ifdef CMAKE_BUILD_WITH_CMAKE
-#include "cmVariableWatch.h"
-#endif
+#include "cmAlgorithms.h"
+#include "cmMakefile.h"
+#include "cmSearchPath.h"
+#include "cmState.h"
+#include "cmStateTypes.h"
+#include "cmVersion.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
 
 #if defined(__HAIKU__)
 #include <FindDirectory.h>
 #include <StorageDefs.h>
-#include <string.h>
 #endif
 
+class cmExecutionStatus;
+class cmFileList;
+
 cmFindPackageCommand::PathLabel cmFindPackageCommand::PathLabel::UserRegistry(
   "PACKAGE_REGISTRY");
 cmFindPackageCommand::PathLabel cmFindPackageCommand::PathLabel::Builds(
@@ -1549,11 +1561,6 @@ void cmFindPackageCommand::StoreVersionFound()
   this->Makefile->AddDefinition(ver + "_COUNT", buf);
 }
 
-#include <cm_auto_ptr.hxx>
-#include <cmsys/Glob.hxx>
-#include <cmsys/String.h>
-
-class cmFileList;
 class cmFileListGeneratorBase
 {
 public:
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 101749e895de5b24dae3d823fcb0e46fc4168630..d4548928dfae9548aa120007e5935d2b7acafe01 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -3,9 +3,18 @@
 #ifndef cmFindPackageCommand_h
 #define cmFindPackageCommand_h
 
+#include <cmConfigure.h>
+#include <cm_kwiml.h>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
 #include "cmFindCommon.h"
 
-class cmFindPackageFileList;
+class cmCommand;
+class cmExecutionStatus;
+class cmSearchPath;
 
 /** \class cmFindPackageCommand
  * \brief Load settings from an external project.
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 66dc5d742d4ad9228c524902a3f59fc833adb2ed..0900f46b7f1f879f54acb3ac3dcf2f3f26c52377 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -2,9 +2,13 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmFindPathCommand.h"
 
+#include <cmsys/Glob.hxx>
+
+#include "cmMakefile.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
-#include <cmsys/Glob.hxx>
+class cmExecutionStatus;
 
 cmFindPathCommand::cmFindPathCommand()
 {
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 4ba67ed40256a4b2383a114e7a73ee7dcd6af2b9..edeeb3a6f9acde946a4f8c25c847372043da6b17 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmFindPathCommand_h
 #define cmFindPathCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmFindBase.h"
 
+class cmCommand;
+class cmExecutionStatus;
+
 /** \class cmFindPathCommand
  * \brief Define a command to search for a library.
  *
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index d258c3c8d2907fa326d6f35857db96dfaba6f00a..2c496ba3ba40d6f856408f48dce8b9d386106b41 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -2,9 +2,11 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmFindProgramCommand.h"
 
+#include "cmMakefile.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
-#include <stdlib.h>
+class cmExecutionStatus;
 
 #if defined(__APPLE__)
 #include <CoreFoundation/CoreFoundation.h>
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 43261248320d8dcff17d77d417eba5e1f61e2c1a..dc17803f07bae155e01eb2db987fb11c33abc260 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmFindProgramCommand_h
 #define cmFindProgramCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmFindBase.h"
 
+class cmCommand;
+class cmExecutionStatus;
+
 /** \class cmFindProgramCommand
  * \brief Define a command to search for an executable program.
  *
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 6fbc93d975461e5a84145a03b35c445aa147a7a7..6273f6e9f5547ce411805d80941720b56dfd9ef5 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -2,9 +2,15 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmForEachCommand.h"
 
-#include "cmSystemTools.h"
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
 
-#include <cm_auto_ptr.hxx>
+#include "cmExecutionStatus.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
 
 cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf)
   : Makefile(mf)
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 9ba4af036f88f656513c776c15014c97c6d0fb85..93c467620ef406242e65bfbf442a7e4e371772be 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -3,11 +3,17 @@
 #ifndef cmForEachCommand_h
 #define cmForEachCommand_h
 
-#include "cmCommand.h"
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
 
+#include "cmCommand.h"
 #include "cmFunctionBlocker.h"
 #include "cmListFileCache.h"
 
+class cmExecutionStatus;
+class cmMakefile;
+
 class cmForEachFunctionBlocker : public cmFunctionBlocker
 {
 public:
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index e9d449611598947afca127a017e387c5f484c3ca..0ba575a011abdfda5018f8bb266ef345727557b7 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -2,9 +2,15 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmFunctionCommand.h"
 
+#include <algorithm>
+#include <sstream>
+
+#include "cmAlgorithms.h"
+#include "cmExecutionStatus.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
 #include "cmState.h"
 #include "cmSystemTools.h"
-#include "cmake.h"
 
 // define the class for function commands
 class cmFunctionHelperCommand : public cmCommand
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index 7d868b2967f0cd11415764c3191bafb9e3807115..afea6f9c87f2cdcf50b38a613c71e04cedfd96d0 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -3,9 +3,16 @@
 #ifndef cmFunctionCommand_h
 #define cmFunctionCommand_h
 
-#include "cmCommand.h"
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
 
+#include "cmCommand.h"
 #include "cmFunctionBlocker.h"
+#include "cmListFileCache.h"
+
+class cmExecutionStatus;
+class cmMakefile;
 
 class cmFunctionFunctionBlocker : public cmFunctionBlocker
 {
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 01b41e86bf3a222d6b430312da3002f84a24f203..c92ae2180cb20f0e3724c68a8fc3fe948f07150d 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -2,11 +2,15 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmGetCMakePropertyCommand.h"
 
+#include <algorithm>
+#include <set>
+
 #include "cmAlgorithms.h"
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
 #include "cmState.h"
-#include "cmStateTypes.h"
-#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmGetCMakePropertyCommand
 bool cmGetCMakePropertyCommand::InitialPass(
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index 30bc2d814025694b1d26a961eeb1fb5782cc1421..41a51a4409af7d4525a00439b508861338b9186d 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmGetCMakePropertyCommand_h
 #define cmGetCMakePropertyCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 class cmGetCMakePropertyCommand : public cmCommand
 {
 public:
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 0670d316925a2aabb5bab1917777003540bde145..920e1a0140453f0b8dcaef1e44bb2caea1a2c9e7 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -3,9 +3,13 @@
 #include "cmGetDirectoryPropertyCommand.h"
 
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
+class cmExecutionStatus;
+
 // cmGetDirectoryPropertyCommand
 bool cmGetDirectoryPropertyCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index 625adb0361154fd86dbaee3eae8e33c45583491e..1ae3125395d59ce7876405474d6bdcb7a7a531aa 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmGetDirectoryPropertyCommand_h
 #define cmGetDirectoryPropertyCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 class cmGetDirectoryPropertyCommand : public cmCommand
 {
 public:
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index c18394742bb2aeef73959bcfe8e265f290d98c70..5915a67fab57ff1148c0e01cfc5cf4d42ba3fd39 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -2,8 +2,12 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmGetFilenameComponentCommand.h"
 
+#include "cmMakefile.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmGetFilenameComponentCommand
 bool cmGetFilenameComponentCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index 68bf31f59314b984ad5029d162374e3764b42647..c0ad903a86531981f5deaec4e475f75dc5f5467d 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmGetFilenameComponentCommand_h
 #define cmGetFilenameComponentCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmGetFilenameComponentCommand
  * \brief Get a specific component of a filename.
  *
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 1852eab31fd6fcc76248f75541589abf571310aa..d2056d29640b282dab7fe109b95f1500068c9f13 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -2,15 +2,26 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmGetPropertyCommand.h"
 
+#include <sstream>
+
 #include "cmGlobalGenerator.h"
+#include "cmInstalledFile.h"
+#include "cmListFileCache.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmProperty.h"
 #include "cmPropertyDefinition.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
-#include "cmStateTypes.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmTargetPropertyComputer.h"
 #include "cmTest.h"
 #include "cmake.h"
 
+class cmExecutionStatus;
+class cmMessenger;
+
 cmGetPropertyCommand::cmGetPropertyCommand()
 {
   this->InfoType = OutValue;
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index 20268b4696db06c9cd3624d29caa9653bd30636a..f9a33acd8c80e2b9faa0636a15a140ede80e2ece 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmGetPropertyCommand_h
 #define cmGetPropertyCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 class cmGetPropertyCommand : public cmCommand
 {
 public:
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 43f92566fe9df317d6cd3ca55fc6733928eaff3c..509ef95b1cddc98d392ab893a659cf7fce1039c1 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -2,8 +2,11 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmGetSourceFilePropertyCommand.h"
 
+#include "cmMakefile.h"
 #include "cmSourceFile.h"
 
+class cmExecutionStatus;
+
 // cmSetSourceFilePropertyCommand
 bool cmGetSourceFilePropertyCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 1edc392c94fc02f1755516e915644d7ef3242220..0f7185122ae35a1953b23287ec1300598a25c8aa 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmGetSourceFilePropertyCommand_h
 #define cmGetSourceFilePropertyCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 class cmGetSourceFilePropertyCommand : public cmCommand
 {
 public:
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index e78f7800ee5517f013fa5cd24e517ec807ec649c..23792922d8ae73cd5514e12299e02338c03709d5 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -2,7 +2,17 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmGetTargetPropertyCommand.h"
 
+#include <sstream>
+
+#include "cmListFileCache.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmTarget.h"
 #include "cmTargetPropertyComputer.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
+class cmMessenger;
 
 // cmSetTargetPropertyCommand
 bool cmGetTargetPropertyCommand::InitialPass(
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index f36cc4891c44d1161fa8ef314db415ce1bb5eea4..32fe803c47869bda76f85d019c1c121d679420ce 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmGetTargetPropertyCommand_h
 #define cmGetTargetPropertyCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 class cmGetTargetPropertyCommand : public cmCommand
 {
 public:
diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx
index 4a445dc30aca8c63c2965029ef6bfb5cc6b1ad99..a8a44b712a0f5247741a8141c1bcb8fbbe91d626 100644
--- a/Source/cmGetTestPropertyCommand.cxx
+++ b/Source/cmGetTestPropertyCommand.cxx
@@ -2,8 +2,10 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmGetTestPropertyCommand.h"
 
+#include "cmMakefile.h"
 #include "cmTest.h"
-#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmGetTestPropertyCommand
 bool cmGetTestPropertyCommand::InitialPass(
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index 5dc89bddb8798de165e22a2cc4ebfa833df8b4c4..0491cc8b07d6d7bc0fd455aab318a0ab816566bb 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmGetTestPropertyCommand_h
 #define cmGetTestPropertyCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 class cmGetTestPropertyCommand : public cmCommand
 {
 public:
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index eb85b16165b37e7a4d0f7e228df6a0a4d7b0b017..a8fa4f92e1d054d4b72a38c79b3ad77d3bf7da12 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -2,15 +2,14 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmIfCommand.h"
 
+#include "cmConditionEvaluator.h"
+#include "cmExecutionStatus.h"
+#include "cmExpandedCommandArgument.h"
+#include "cmMakefile.h"
 #include "cmOutputConverter.h"
-#include "cmStringCommand.h"
 #include "cmSystemTools.h"
-
-#include "cmConditionEvaluator.h"
-
-#include <cmsys/RegularExpression.hxx>
-#include <list>
-#include <stdlib.h> // required for atof
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
 
 static std::string cmIfCommandError(
   std::vector<cmExpandedCommandArgument> const& args)
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index e071acb0c099f856324e388455bd4b1be7e4ed55..56eef30e26e7865b8fe94e20731064eec0a13088 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -3,9 +3,17 @@
 #ifndef cmIfCommand_h
 #define cmIfCommand_h
 
-#include "cmCommand.h"
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
 
+#include "cmCommand.h"
 #include "cmFunctionBlocker.h"
+#include "cmListFileCache.h"
+
+class cmExecutionStatus;
+class cmExpandedCommandArgument;
+class cmMakefile;
 
 class cmIfFunctionBlocker : public cmFunctionBlocker
 {
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index e89641f4eeb4a3d4cf9bf68436950fa81d149af4..0f7799e58845ccaef2401715ffa02f0e94e6c341 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -2,8 +2,15 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmIncludeCommand.h"
 
+#include <sstream>
+
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmIncludeCommand
 bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index 9065ef7b822b7e1113b2a13140674f15a7b7bcc3..78edd43c22bb8dd01cab72b8bb9e7a914e87cfad 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmIncludeCommand_h
 #define cmIncludeCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmIncludeCommand
  * \brief cmIncludeCommand defines a list of distant
  *  files that can be "included" in the current list file.
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index 2260366e21fd1980aadb1065a3879532a0579898..cdb02797240265beaf87f5a09ee14e9dc4b80562 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -2,8 +2,14 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmIncludeDirectoryCommand.h"
 
+#include <algorithm>
+#include <set>
+
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmIncludeDirectoryCommand
 bool cmIncludeDirectoryCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index d0a20b379ae271b68b1e545c9d94a815ad05a841..287b5d3cd05ec6cf6e0892c72c05c9f0e4118bd5 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmIncludeDirectoryCommand_h
 #define cmIncludeDirectoryCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmIncludeDirectoryCommand
  * \brief Add include directories to the build.
  *
diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
index e7e940245e3c91d007b8e0050c2f1e6adc87e033..03388c7e9da9b8f1c85d6d25260a0905579ecc43 100644
--- a/Source/cmIncludeExternalMSProjectCommand.cxx
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -3,7 +3,10 @@
 #include "cmIncludeExternalMSProjectCommand.h"
 
 #ifdef _WIN32
+#include "cmMakefile.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
+#include "cmTarget.h"
 #endif
 
 class cmExecutionStatus;
diff --git a/Source/cmIncludeRegularExpressionCommand.cxx b/Source/cmIncludeRegularExpressionCommand.cxx
index 6dc20a06033c864073b55a33a74739edb72e7f83..073c95f7db9f387d45b34931c1f5b66d25a1d7b0 100644
--- a/Source/cmIncludeRegularExpressionCommand.cxx
+++ b/Source/cmIncludeRegularExpressionCommand.cxx
@@ -2,6 +2,10 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmIncludeRegularExpressionCommand.h"
 
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
 // cmIncludeRegularExpressionCommand
 bool cmIncludeRegularExpressionCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index b7c937d13be8a38bd366fa5fa8672760d836efda..c68d9f297e3fab5d0884915f64c29e99173348f0 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmIncludeRegularExpressionCommand_h
 #define cmIncludeRegularExpressionCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmIncludeRegularExpressionCommand
  * \brief Set the regular expression for following #includes.
  *
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 476755a4ebe1885906cdc6732b7b8f38570321d6..7bf946293af1c98dc4d6ac7b389395e09c4b2dbf 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -2,18 +2,33 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmInstallCommand.h"
 
+#include <algorithm>
+#include <cmsys/Glob.hxx>
+#include <sstream>
+#include <stddef.h>
+
+#include "cmAlgorithms.h"
+#include "cmCommandArgumentsHelper.h"
 #include "cmExportSet.h"
+#include "cmExportSetMap.h"
+#include "cmGeneratorExpression.h"
 #include "cmGlobalGenerator.h"
 #include "cmInstallCommandArguments.h"
 #include "cmInstallDirectoryGenerator.h"
 #include "cmInstallExportGenerator.h"
 #include "cmInstallFilesGenerator.h"
+#include "cmInstallGenerator.h"
 #include "cmInstallScriptGenerator.h"
 #include "cmInstallTargetGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmTargetExport.h"
+#include "cmake.h"
 
-#include <cmsys/Glob.hxx>
+class cmExecutionStatus;
 
 static cmInstallTargetGenerator* CreateInstallTargetGenerator(
   cmTarget& target, const cmInstallCommandArguments& args, bool impLib,
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index b35033005927b959d024662b3110e744a64cee57..187a6ceae1126a85153771372f312ec4bd1f43eb 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmInstallCommand_h
 #define cmInstallCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmInstallCommand
  * \brief Specifies where to install some files
  *
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 50f97e9ea3f9ef4e80c91d23cf8fec9e4e1ffc4c..86fd46dbb23f142eb52b0fbac6c32a3634d85c88 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -2,10 +2,15 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmInstallFilesCommand.h"
 
+#include "cmGeneratorExpression.h"
 #include "cmGlobalGenerator.h"
 #include "cmInstallFilesGenerator.h"
+#include "cmInstallGenerator.h"
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmExecutableCommand
 bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
                                         cmExecutionStatus&)
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index da09fae448dc9cc377b234ed353af3315271e5fd..c3e2919644167a0366b325e33b763b161de8e66a 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmInstallFilesCommand_h
 #define cmInstallFilesCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmInstallFilesCommand
  * \brief Specifies where to install some files
  *
diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx
index 07f990dafb7bcbf4521f962d1c64b1f9196f8463..e00eba01276f71abc29db085a83464f68a23e10a 100644
--- a/Source/cmInstallTargetsCommand.cxx
+++ b/Source/cmInstallTargetsCommand.cxx
@@ -2,7 +2,14 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmInstallTargetsCommand.h"
 
+#include <utility>
+
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmTarget.h"
+#include "cm_unordered_map.hxx"
+
+class cmExecutionStatus;
 
 // cmExecutableCommand
 bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 0625722ec37ccbc6185957306a0dc4956a5e5cee..150397d34f41b53908beeec16ef643bdb188c29e 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmInstallTargetsCommand_h
 #define cmInstallTargetsCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmInstallTargetsCommand
  * \brief Specifies where to install some targets
  *
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index 3a18a437ddc581a93eaa616df9effa18c246723b..f86329249342dd91be25be8b03142c3ed0eb1243 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -2,7 +2,14 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmLinkDirectoriesCommand.h"
 
+#include <sstream>
+
+#include "cmMakefile.h"
+#include "cmPolicies.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmLinkDirectoriesCommand
 bool cmLinkDirectoriesCommand::InitialPass(
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index ba0313b63d72b9956a91ba386a7aa9412d187d64..387b3b94fc45d02ca7702c01ad4b2b85cfa5fd80 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmLinkDirectoriesCommand_h
 #define cmLinkDirectoriesCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmLinkDirectoriesCommand
  * \brief Define a list of directories containing files to link.
  *
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 6cc95901778936e01cfba120fdaccf18351c1053..295ea288fd290d3b84e895725034562da2813a1d 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -2,15 +2,22 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmListCommand.h"
 
-#include "cmAlgorithms.h"
-#include "cmSystemTools.h"
-#include <cmsys/RegularExpression.hxx>
-#include <cmsys/SystemTools.hxx>
-
 #include <algorithm>
 #include <assert.h>
-#include <ctype.h>
+#include <cmsys/RegularExpression.hxx>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
 #include <stdlib.h> // required for atoi
+
+#include "cmAlgorithms.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
+
 bool cmListCommand::InitialPass(std::vector<std::string> const& args,
                                 cmExecutionStatus&)
 {
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 43a482ca9a529f92a4e6b28be11a4408e7b4bead..e7413caa9a91009a302fa6a26609790d2d046382 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmListCommand_h
 #define cmListCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmListCommand
  * \brief Common list operations
  *
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 2a06cb4d7ecfa825c736f5f4b24b2bb62ed009b8..ea84877a9bd7017edd34c9d3c5e9db8ed112af8d 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -5,7 +5,7 @@
 #include <cmsys/FStream.hxx>
 
 #include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 9bfc70bab7f75b757c2876c2689c71c69b88bd5c..d777bd5425232b4091dbb6444694d47cd0a412aa 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -2,10 +2,16 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmMacroCommand.h"
 
+#include <algorithm>
+#include <sstream>
+#include <stdio.h>
+
 #include "cmAlgorithms.h"
+#include "cmExecutionStatus.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
 #include "cmState.h"
 #include "cmSystemTools.h"
-#include "cmake.h"
 
 // define the class for macro commands
 class cmMacroHelperCommand : public cmCommand
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index 8e3cd95a9a585012efb13fe5fcfbeb7e8f12feea..acb42339ce83e3ead3014c54639dfdfc6bebb66d 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -3,9 +3,16 @@
 #ifndef cmMacroCommand_h
 #define cmMacroCommand_h
 
-#include "cmCommand.h"
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
 
+#include "cmCommand.h"
 #include "cmFunctionBlocker.h"
+#include "cmListFileCache.h"
+
+class cmExecutionStatus;
+class cmMakefile;
 
 class cmMacroFunctionBlocker : public cmFunctionBlocker
 {
diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx
index fda9eeaa6abc074ace0a517e62aee2a7cdc48df7..06e295bc04a9f130fb70efb692b89dc35c62be55 100644
--- a/Source/cmMakeDirectoryCommand.cxx
+++ b/Source/cmMakeDirectoryCommand.cxx
@@ -2,8 +2,11 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmMakeDirectoryCommand.h"
 
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmMakeDirectoryCommand
 bool cmMakeDirectoryCommand::InitialPass(std::vector<std::string> const& args,
                                          cmExecutionStatus&)
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index 74b4a6361b48e9013f7ab7f4e6b87676db892261..d9cce6f7355b111e756dff1ff8ba37a5a27beb90 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmMakeDirectoryCommand_h
 #define cmMakeDirectoryCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmMakeDirectoryCommand
  * \brief Specify auxiliary source code directories.
  *
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index 7297193a8332adab5564ccef62d789c1b2356e2c..b2f0d22e1cba2d1544d73432d686a357dc7548ad 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -2,8 +2,13 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmMarkAsAdvancedCommand.h"
 
+#include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmMarkAsAdvancedCommand
 bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 0f5270cd65df97c3ac0177edeb0532aefa964afb..26caa66249bee916790d9a1d87754b3bd32b4e89 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmMarkAsAdvancedCommand_h
 #define cmMarkAsAdvancedCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmMarkAsAdvancedCommand
  * \brief mark_as_advanced command
  *
diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx
index 42e6b90f2d160d4e3a47c567e0d65d63c404901e..c1cd1b6c2ad8e5ff321b22eb1cccb112929c52cf 100644
--- a/Source/cmMathCommand.cxx
+++ b/Source/cmMathCommand.cxx
@@ -2,7 +2,12 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmMathCommand.h"
 
+#include <stdio.h>
+
 #include "cmExprParserHelper.h"
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
 
 bool cmMathCommand::InitialPass(std::vector<std::string> const& args,
                                 cmExecutionStatus&)
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index 17a1575e6b02aba92b23c5024791f94d5853472e..9b49b211b90fc5f11baa18da59cbb7df3d6651aa 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmMathCommand_h
 #define cmMathCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /// Mathematical expressions: math(EXPR ...) command.
 class cmMathCommand : public cmCommand
 {
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 83d847a1fddab0a90a44496187a1290c91aaf879..2e157206ead3dca8f427c0dabed5a7f79f55c50f 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -2,8 +2,15 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmMessageCommand.h"
 
+#include <algorithm>
+
+#include "cmAlgorithms.h"
+#include "cmMakefile.h"
 #include "cmMessenger.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmLibraryCommand
 bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index cd16ffa09d2c1044e0f15b99b17684415a55aff9..a5656355b9144c5309293b4b5122d12e0ae9b686 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmMessageCommand_h
 #define cmMessageCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmMessageCommand
  * \brief Displays a message to the user
  *
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index d6efa2c23cdf577fcac517b59591a941dfdf95e7..bbd6090943407fbc1c8e6f05ff625ed8deeeaff5 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -2,9 +2,16 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmOptionCommand.h"
 
+#include <algorithm>
+
+#include "cmAlgorithms.h"
+#include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmOptionCommand
 bool cmOptionCommand::InitialPass(std::vector<std::string> const& args,
                                   cmExecutionStatus&)
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index d77215a579e4b9cda30f74c91e9718f0756c1f67..09567ffc2fbfdbb4c9a1992c4e9b88e8c61faecf 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmOptionCommand_h
 #define cmOptionCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmOptionCommand
  * \brief Provide an option to the user
  *
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 6ecd942b1a023f986173c0f11ed1c4e48c6976c8..32b0a9248beafad5c060b57d76b09d0d3623affa 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -4,6 +4,8 @@
 
 #include <cmsys/FStream.hxx>
 #include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <utility>
 
 #include "cmAlgorithms.h"
 #include "cmGeneratorExpression.h"
@@ -12,6 +14,7 @@
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
+#include "cm_unordered_map.hxx"
 
 class cmExecutionStatus;
 
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index e45e3a511cd47828ebcb80ab58b8fdebce38a11d..0a2dd12fee80359062f400a41aef91dbfa09530b 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -2,8 +2,19 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmParseArgumentsCommand.h"
 
+#include <algorithm>
+#include <map>
+#include <set>
+#include <sstream>
+#include <stddef.h>
+#include <utility>
+
 #include "cmAlgorithms.h"
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 static std::string escape_arg(const std::string& arg)
 {
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index af87d81c80497a266d362a16e00fa4055386a719..079eadb82b6ba4fdb3be475ac7ba1e996295ed5c 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmParseArgumentsCommand_h
 #define cmParseArgumentsCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmParseArgumentsCommand
  *
  */
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 4188661d591f2536bad3a45b6590b70218fec2ed..4e0fa575aaf3f6cae7f48f892a651bac7f583bc0 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -2,7 +2,17 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmProjectCommand.h"
 
+#include <cmsys/RegularExpression.hxx>
+#include <sstream>
+#include <stdio.h>
+
+#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmProjectCommand
 bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index ef554f3d6b5e944ac693f636f47f632b391eb1f7..cd92176c3a700d688441ea0cff9f3346dd8003f6 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmProjectCommand_h
 #define cmProjectCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmProjectCommand
  * \brief Specify the name for this build project.
  *
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index 06b91bc49ed58178124d39868d8e10cfd160337e..9496d67a378d3894495b9cbd4b3bb2a476891c3e 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmReturnCommand_h
 #define cmReturnCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmReturnCommand
  * \brief Return from a directory or function
  *
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index fd3d4829a4f2cd1aee8f3d9be7157aa73c401de0..ff0b8363a537d5b513ef40021c34c7fb58460a64 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -2,8 +2,11 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSearchPath.h"
 
+#include <cassert>
+
 #include "cmAlgorithms.h"
 #include "cmFindCommon.h"
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
 cmSearchPath::cmSearchPath(cmFindCommon* findCmd)
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index 77546a3851da9f7e242b5cb7471414c27cf3d90c..b27d227f3439050c2a2909509957bab0be972fd6 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -2,8 +2,14 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSeparateArgumentsCommand.h"
 
+#include <algorithm>
+#include <sstream>
+
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmSeparateArgumentsCommand
 bool cmSeparateArgumentsCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index d80d04354f033c785e95af29ca43d161bbb8e7df..1cbf56e79fb233cd2f40578c9136df1aa4ccb424 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmSeparateArgumentsCommand_h
 #define cmSeparateArgumentsCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmSeparateArgumentsCommand
  * \brief separate_arguments command
  *
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 9f59db4a6338757a4ee059eab54b1b59960911cb..e49f142fd266c978834df9b038825cc00169e553 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -2,9 +2,17 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSetCommand.h"
 
+#include <algorithm>
+#include <string.h>
+
+#include "cmAlgorithms.h"
+#include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmSetCommand
 bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
                                cmExecutionStatus&)
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 6fa386519648f898eeecf8a948bf34ab2023c07f..190092acceb8a3b2b83ad08b299485290d78f518 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmSetCommand_h
 #define cmSetCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmSetCommand
  * \brief Set a CMAKE variable
  *
diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx
index b0de021a59eeb72d28e1cc7985bf8c330e93e2ef..8d3961a7952da1b883dce904c905b6485d282333 100644
--- a/Source/cmSetDirectoryPropertiesCommand.cxx
+++ b/Source/cmSetDirectoryPropertiesCommand.cxx
@@ -2,7 +2,9 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSetDirectoryPropertiesCommand.h"
 
-#include "cmake.h"
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
 
 // cmSetDirectoryPropertiesCommand
 bool cmSetDirectoryPropertiesCommand::InitialPass(
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index 9608742b332eef7339c7c5370850070f8ba2bae7..854ad4374a3f9e7a4ee509eec541435616a26558 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmSetDirectoryPropertiesCommand_h
 #define cmSetDirectoryPropertiesCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+class cmMakefile;
+
 class cmSetDirectoryPropertiesCommand : public cmCommand
 {
 public:
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 552f9185a0c2951837ee344c33b4828f2b4f699b..79221c893a3ce2a4f66cffd86f74161a10491032 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -2,13 +2,20 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSetPropertyCommand.h"
 
+#include <sstream>
+
 #include "cmGlobalGenerator.h"
-#include "cmSetSourceFilesPropertiesCommand.h"
-#include "cmSetTargetPropertiesCommand.h"
-#include "cmSetTestsPropertiesCommand.h"
+#include "cmInstalledFile.h"
+#include "cmMakefile.h"
+#include "cmProperty.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmTest.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 cmSetPropertyCommand::cmSetPropertyCommand()
 {
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index b4dff768d6ed439f46eedb749290660295e4ea52..fd7c922abbce9cd53c3f6b9feaefd2ddb9352cb0 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -3,8 +3,19 @@
 #ifndef cmSetsPropertiesCommand_h
 #define cmSetsPropertiesCommand_h
 
+#include <cmConfigure.h>
+#include <set>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+class cmInstalledFile;
+class cmSourceFile;
+class cmTarget;
+class cmTest;
+
 class cmSetPropertyCommand : public cmCommand
 {
 public:
diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx
index 6a87d6d5aa205808f65fe8df1f0a02158063c7a2..33e1b2e062df46ea585f2370150e4a962dda2e5a 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.cxx
+++ b/Source/cmSetSourceFilesPropertiesCommand.cxx
@@ -2,9 +2,12 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSetSourceFilesPropertiesCommand.h"
 
+#include "cmMakefile.h"
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmSetSourceFilesPropertiesCommand
 bool cmSetSourceFilesPropertiesCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index 62cc40487f27eff03e54f0aee1cbb0e975cfe334..8fa12c78060496e1e8028f5b6be56ca00e283779 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmSetSourceFilesPropertiesCommand_h
 #define cmSetSourceFilesPropertiesCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+class cmMakefile;
+
 class cmSetSourceFilesPropertiesCommand : public cmCommand
 {
 public:
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx
index 200b42de815d917f2eead5c9b2d3cae53b212a07..da2697231bd27026922a527cde3a3f2b81dad4cb 100644
--- a/Source/cmSetTargetPropertiesCommand.cxx
+++ b/Source/cmSetTargetPropertiesCommand.cxx
@@ -2,7 +2,12 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSetTargetPropertiesCommand.h"
 
-#include "cmGlobalGenerator.h"
+#include <iterator>
+
+#include "cmMakefile.h"
+#include "cmTarget.h"
+
+class cmExecutionStatus;
 
 // cmSetTargetPropertiesCommand
 bool cmSetTargetPropertiesCommand::InitialPass(
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index ed02fa86f9ea8cea05f50e97d5c1f99c4293de92..c3c0d06cfeb3d918ec27b495e4f498e68082e97a 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmSetTargetsPropertiesCommand_h
 #define cmSetTargetsPropertiesCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+class cmMakefile;
+
 class cmSetTargetPropertiesCommand : public cmCommand
 {
 public:
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index 5abb84e28dca795bdb1b57dccb15f9542a26d2bc..4fd379fba497a7e53f623067a590b47f486d29a8 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -2,8 +2,12 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSetTestsPropertiesCommand.h"
 
+#include <iterator>
+
+#include "cmMakefile.h"
 #include "cmTest.h"
-#include "cmake.h"
+
+class cmExecutionStatus;
 
 // cmSetTestsPropertiesCommand
 bool cmSetTestsPropertiesCommand::InitialPass(
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 04ba76e4bfe71eb9905b881661e369c2d78607e9..45aed792c9eb610cef0985fb64b94ba6edb4f3a3 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmSetTestsPropertiesCommand_h
 #define cmSetTestsPropertiesCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+class cmMakefile;
+
 class cmSetTestsPropertiesCommand : public cmCommand
 {
 public:
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index 18c2a3efe07976eda677fb5a3bf4bbc9617e1f1a..4322a6d282481c4807fbe72b68debb84bce924f5 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -2,9 +2,13 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSiteNameCommand.h"
 
+#include <cmsys/RegularExpression.hxx>
+
+#include "cmMakefile.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
-#include <cmsys/RegularExpression.hxx>
+class cmExecutionStatus;
 
 // cmSiteNameCommand
 bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index 48d1035fc55db5c24c3c32298cae66b3f739754a..01023b96ee3e82004fc9c19f44f0c8a48a343cd4 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmSiteNameCommand_h
 #define cmSiteNameCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmSiteNameCommand
  * \brief site_name command
  *
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 33d22e45399c5e6409d8124f3e114c2c50927943..512bc9131f7bf6d51c6363496964e22f127d821d 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -2,18 +2,23 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmStringCommand.h"
 
-#include "cmCryptoHash.h"
-#include "cmSystemTools.h"
-
+#include <algorithm>
 #include <cmsys/RegularExpression.hxx>
-#include <cmsys/SystemTools.hxx>
-
 #include <ctype.h>
-#include <stdlib.h> // required for atoi
-#include <time.h>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "cmAlgorithms.h"
+#include "cmCryptoHash.h"
+#include "cmGeneratorExpression.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+#include "cmTimestamp.h"
+#include "cmUuid.h"
+#include "cm_auto_ptr.hxx"
 
-#include <cmTimestamp.h>
-#include <cmUuid.h>
+class cmExecutionStatus;
 
 bool cmStringCommand::InitialPass(std::vector<std::string> const& args,
                                   cmExecutionStatus&)
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index b928f3caef583f231238fba6207f42a5ccac4a03..c63bc3f9079adc1b04465b4b59c591af12b47433 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -3,12 +3,13 @@
 #ifndef cmStringCommand_h
 #define cmStringCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
-class cmMakefile;
-namespace cmsys {
-class RegularExpression;
-}
+class cmExecutionStatus;
 
 /** \class cmStringCommand
  * \brief Common string operations
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx
index d502c5f324eca188a5c16773e96dd9b11a3a449f..55761bfd72967b70c6b120b2fbcf267c0403fe52 100644
--- a/Source/cmSubdirCommand.cxx
+++ b/Source/cmSubdirCommand.cxx
@@ -2,8 +2,11 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSubdirCommand.h"
 
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmSubdirCommand
 bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
                                   cmExecutionStatus&)
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index 077863862aead1dc72617d4ec8b78879d47aae24..ce1f876e8456e71bc9d554db867ed8688704b96f 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmSubdirCommand_h
 #define cmSubdirCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmSubdirCommand
  * \brief Specify a list of subdirectories to build.
  *
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 962699274e690457bfa5939e39d27001a3999d21..e1730364545ffebcff5a85d4274faed7238cbe5a 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -2,10 +2,20 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmTargetLinkLibrariesCommand.h"
 
+#include <sstream>
+#include <string.h>
+
 #include "cmGeneratorExpression.h"
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmPolicies.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
 
 const char* cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[3] = {
   "general", "debug", "optimized"
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 69bb6ebc896441301619c4bd1f68e7e8a3aff838..762b48fc079f44ff8598e52971cab0a1686cd01c 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -3,7 +3,15 @@
 #ifndef cmTargetLinkLibrariesCommand_h
 #define cmTargetLinkLibrariesCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
+#include "cmTargetLinkLibraryType.h"
+
+class cmExecutionStatus;
+class cmTarget;
 
 /** \class cmTargetLinkLibrariesCommand
  * \brief Specify a list of libraries to link into executables.
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index e2e02ad66aadd56ef9940fece78308c588ee1882..7aba0f85d33e66008633887bb9940e98ed407734 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -3,6 +3,7 @@
 #include "cmTargetPropCommandBase.h"
 
 #include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
 
 bool cmTargetPropCommandBase::HandleArguments(
   std::vector<std::string> const& args, const std::string& prop,
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index 933818eddddd3b6d252850a37c35820a22b0ebd2..b6bfbfa69cb1f13e3bc7d4ec32a826eda1259d06 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -2,6 +2,11 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmTryCompileCommand.h"
 
+#include "cmMakefile.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
+
 // cmTryCompileCommand
 bool cmTryCompileCommand::InitialPass(std::vector<std::string> const& argv,
                                       cmExecutionStatus&)
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index ed74ae12ab19e2588a7bc53dec5355debbab44ad..52a034591f2fae0c4ee21d2b5464be2baea8eb4e 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmTryCompileCommand_h
 #define cmTryCompileCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCoreTryCompile.h"
 
+class cmCommand;
+class cmExecutionStatus;
+
 /** \class cmTryCompileCommand
  * \brief Specifies where to install some files
  *
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 6787c8e38a09a0a408430a9502c122f0997645a3..9457d5b2e5f44e7393e6d8284c8679962daa0b24 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -2,11 +2,17 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmTryRunCommand.h"
 
+#include <cmsys/FStream.hxx>
+#include <stdio.h>
+#include <string.h>
+
+#include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
-#include "cmTryCompileCommand.h"
+#include "cmake.h"
 
-#include <cmsys/FStream.hxx>
+class cmExecutionStatus;
 
 // cmTryRunCommand
 bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index 24447edb92e781745de7fac0752c3fde647a1274..8b44ac5a98db29fb0298b4359237411308766690 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -3,8 +3,15 @@
 #ifndef cmTryRunCommand_h
 #define cmTryRunCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCoreTryCompile.h"
 
+class cmCommand;
+class cmExecutionStatus;
+
 /** \class cmTryRunCommand
  * \brief Specifies where to install some files
  *
diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx
index 2fea6192564775cf5dcca8ef1a14087066882142..31525ba4a6d9f1ead9dda4f2bc113d4728061712 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -2,8 +2,14 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmUnsetCommand.h"
 
+#include <string.h>
+
+#include "cmAlgorithms.h"
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
 
+class cmExecutionStatus;
+
 // cmUnsetCommand
 bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args,
                                  cmExecutionStatus&)
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index 37b9270e6cc66a05475b1db9617fe1decdd618ed..5b07202fca8b430c8218c7b1a25c3b78fb60e65d 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -3,8 +3,14 @@
 #ifndef cmUnsetCommand_h
 #define cmUnsetCommand_h
 
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
 #include "cmCommand.h"
 
+class cmExecutionStatus;
+
 /** \class cmUnsetCommand
  * \brief Unset a CMAKE variable
  *
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index f98d512cd69dec917bad38d5854f042d32ea827e..3b78abec08f438450ef646f3379638c1a8755534 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -7,7 +7,7 @@
 #include "cmMakefile.h"
 #include "cmPolicies.h"
 #include "cmState.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
 class cmExecutionStatus;
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index beb59bfbdaca0b6a88b0362e31fff8319efede09..38ea637e2d3632428615991cc8e1fab9fd5e0a61 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -3,7 +3,12 @@
 #include "cmWhileCommand.h"
 
 #include "cmConditionEvaluator.h"
+#include "cmExecutionStatus.h"
+#include "cmExpandedCommandArgument.h"
+#include "cmMakefile.h"
 #include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
 
 cmWhileFunctionBlocker::cmWhileFunctionBlocker(cmMakefile* mf)
   : Makefile(mf)
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index cc114eca2be1bfddc0778fcaeece2b584ae112f5..abd36b329384db6884d4c220bf0543cd7a17130f 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -3,11 +3,17 @@
 #ifndef cmWhileCommand_h
 #define cmWhileCommand_h
 
-#include "cmCommand.h"
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
 
+#include "cmCommand.h"
 #include "cmFunctionBlocker.h"
 #include "cmListFileCache.h"
 
+class cmExecutionStatus;
+class cmMakefile;
+
 class cmWhileFunctionBlocker : public cmFunctionBlocker
 {
 public: