summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx1
-rw-r--r--Source/QtDialog/CMakeSetup.cxx2
-rw-r--r--Source/cmAlgorithms.h14
-rw-r--r--Source/cmCMakeMinimumRequired.cxx6
-rw-r--r--Source/cmCMakeMinimumRequired.h6
-rw-r--r--Source/cmCTest.cxx45
-rw-r--r--Source/cmCacheManager.cxx11
-rw-r--r--Source/cmCacheManager.h6
-rw-r--r--Source/cmCommandArgumentsHelper.h6
-rw-r--r--Source/cmCommonTargetGenerator.cxx3
-rw-r--r--Source/cmCommonTargetGenerator.h5
-rw-r--r--Source/cmConditionEvaluator.cxx12
-rw-r--r--Source/cmConditionEvaluator.h10
-rw-r--r--Source/cmCoreTryCompile.cxx14
-rw-r--r--Source/cmCoreTryCompile.h5
-rw-r--r--Source/cmCreateTestSourceList.cxx4
-rw-r--r--Source/cmCreateTestSourceList.h7
-rw-r--r--Source/cmDefinitions.cxx1
-rw-r--r--Source/cmDefinitions.h8
-rw-r--r--Source/cmDependsC.cxx7
-rw-r--r--Source/cmDependsFortran.cxx17
-rw-r--r--Source/cmDependsJavaParserHelper.h2
-rw-r--r--Source/cmExecutionStatus.h4
-rw-r--r--Source/cmExpandedCommandArgument.h4
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx18
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.h10
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.cxx11
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.h10
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx11
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx17
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx14
-rw-r--r--Source/cmFileCommand.cxx1
-rw-r--r--Source/cmFileTimeComparison.cxx1
-rw-r--r--Source/cmFindBase.cxx6
-rw-r--r--Source/cmFindBase.h5
-rw-r--r--Source/cmFindCommon.cxx7
-rw-r--r--Source/cmFindCommon.h9
-rw-r--r--Source/cmFunctionBlocker.h7
-rw-r--r--Source/cmFunctionCommand.cxx1
-rw-r--r--Source/cmGeneratedFileStream.cxx5
-rw-r--r--Source/cmGeneratorExpression.cxx7
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx11
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h13
-rw-r--r--Source/cmGeneratorTarget.cxx22
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx1
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalGenerator.cxx21
-rw-r--r--Source/cmGlobalGenerator.h22
-rw-r--r--Source/cmGlobalGeneratorFactory.h7
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx4
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx24
-rw-r--r--Source/cmGlobalNinjaGenerator.h22
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx11
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h10
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx1
-rw-r--r--Source/cmGraphAdjacencyList.h4
-rw-r--r--Source/cmGraphVizWriter.cxx11
-rw-r--r--Source/cmHexFileConverter.cxx5
-rw-r--r--Source/cmHexFileConverter.h4
-rw-r--r--Source/cmInstallCommand.cxx1
-rw-r--r--Source/cmInstallCommandArguments.cxx2
-rw-r--r--Source/cmInstallCommandArguments.h5
-rw-r--r--Source/cmInstallTargetGenerator.cxx13
-rw-r--r--Source/cmLinkItem.h8
-rw-r--r--Source/cmLinkLineComputer.cxx5
-rw-r--r--Source/cmLinkLineComputer.h4
-rw-r--r--Source/cmLinkedTree.h4
-rw-r--r--Source/cmLocalCommonGenerator.cxx5
-rw-r--r--Source/cmLocalCommonGenerator.h5
-rw-r--r--Source/cmLocalGenerator.cxx3
-rw-r--r--Source/cmLocalGenerator.h19
-rw-r--r--Source/cmLocalNinjaGenerator.cxx15
-rw-r--r--Source/cmLocalNinjaGenerator.h10
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx19
-rw-r--r--Source/cmLocale.h2
-rw-r--r--Source/cmMSVC60LinkLineComputer.cxx6
-rw-r--r--Source/cmMSVC60LinkLineComputer.h7
-rw-r--r--Source/cmMacroCommand.cxx1
-rw-r--r--Source/cmMakefile.cxx28
-rw-r--r--Source/cmMakefile.h20
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx11
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx11
-rw-r--r--Source/cmMakefileTargetGenerator.cxx14
-rw-r--r--Source/cmMakefileTargetGenerator.h12
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx10
-rw-r--r--Source/cmMessageCommand.cxx2
-rw-r--r--Source/cmNinjaLinkLineComputer.cxx4
-rw-r--r--Source/cmNinjaLinkLineComputer.h7
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx21
-rw-r--r--Source/cmNinjaTargetGenerator.cxx19
-rw-r--r--Source/cmNinjaTypes.h6
-rw-r--r--Source/cmOptionCommand.cxx2
-rw-r--r--Source/cmOutputConverter.cxx11
-rw-r--r--Source/cmOutputConverter.h6
-rw-r--r--Source/cmParseArgumentsCommand.cxx1
-rw-r--r--Source/cmPathLabel.cxx2
-rw-r--r--Source/cmPathLabel.h4
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx2
-rw-r--r--Source/cmQtAutoGenerators.cxx23
-rw-r--r--Source/cmRulePlaceholderExpander.cxx4
-rw-r--r--Source/cmRulePlaceholderExpander.h1
-rw-r--r--Source/cmSearchPath.cxx2
-rw-r--r--Source/cmSearchPath.h4
-rw-r--r--Source/cmServer.cxx1
-rw-r--r--Source/cmServerConnection.cxx1
-rw-r--r--Source/cmSetCommand.cxx1
-rw-r--r--Source/cmSourceFile.cxx5
-rw-r--r--Source/cmState.cxx16
-rw-r--r--Source/cmState.h15
-rw-r--r--Source/cmStateDirectory.cxx10
-rw-r--r--Source/cmStateDirectory.h3
-rw-r--r--Source/cmStatePrivate.h7
-rw-r--r--Source/cmStateSnapshot.cxx14
-rw-r--r--Source/cmStateSnapshot.h2
-rw-r--r--Source/cmStateTypes.h4
-rw-r--r--Source/cmStringCommand.cxx1
-rw-r--r--Source/cmSystemTools.h6
-rw-r--r--Source/cmTarget.cxx18
-rw-r--r--Source/cmTarget.h17
-rw-r--r--Source/cmTargetCompileFeaturesCommand.cxx1
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx1
-rw-r--r--Source/cmTargetDepend.h4
-rw-r--r--Source/cmTargetExport.h6
-rw-r--r--Source/cmTargetPropCommandBase.cxx3
-rw-r--r--Source/cmTargetPropCommandBase.h5
-rw-r--r--Source/cmTargetPropertyComputer.cxx11
-rw-r--r--Source/cmTargetPropertyComputer.h7
-rw-r--r--Source/cmTargetSourcesCommand.cxx1
-rw-r--r--Source/cmTest.cxx1
-rw-r--r--Source/cmTestGenerator.cxx9
-rw-r--r--Source/cmTimestamp.cxx8
-rw-r--r--Source/cmTimestamp.h4
-rw-r--r--Source/cm_codecvt.hxx3
-rw-r--r--Source/cmake.cxx5
-rw-r--r--Source/cmake.h12
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Source/cmcmd.cxx1
140 files changed, 660 insertions, 442 deletions
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 7ee0f751d6..08ea4eeddd 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -22,6 +22,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 9038469bb0..5e03c39391 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -5,6 +5,7 @@
#include "CMakeSetupDialog.h"
#include "cmAlgorithms.h"
#include "cmDocumentation.h"
+#include "cmDocumentationEntry.h"
#include "cmVersion.h"
#include "cmake.h"
#include <QApplication>
@@ -17,6 +18,7 @@
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/Encoding.hxx>
#include <cmsys/SystemTools.hxx>
+#include <iostream>
#include "cmSystemTools.h" // IWYU pragma: keep
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index aa553795d4..22f69fa4ef 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -3,9 +3,17 @@
#ifndef cmAlgorithms_h
#define cmAlgorithms_h
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <algorithm>
+#include <cm_kwiml.h>
+#include <functional>
+#include <iterator>
+#include <sstream>
+#include <string.h>
+#include <string>
+#include <utility>
+#include <vector>
inline bool cmHasLiteralPrefixImpl(const std::string& str1, const char* str2,
size_t N)
diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx
index 655c42aa90..942688ceeb 100644
--- a/Source/cmCMakeMinimumRequired.cxx
+++ b/Source/cmCMakeMinimumRequired.cxx
@@ -2,9 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCMakeMinimumRequired.h"
+#include <sstream>
+#include <stdio.h>
+
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
// cmCMakeMinimumRequired
bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args,
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 3acedd2c6a..08a5c38e80 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -3,8 +3,14 @@
#ifndef cmCMakeMinimumRequired_h
#define cmCMakeMinimumRequired_h
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmCMakeMinimumRequired
* \brief cmake_minimum_required command
*
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 024260c09f..010fc4e3a0 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2,6 +2,27 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTest.h"
+#include <cm_curl.h>
+#include <cm_zlib.h>
+#include <cmsys/Base64.h>
+#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
+#include <cmsys/Glob.hxx>
+#include <cmsys/Process.h>
+#include <cmsys/String.hxx>
+#include <cmsys/SystemInformation.hxx>
+#include <ctype.h>
+#include <iostream>
+#include <map>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <string>
+#include <time.h>
+#include <utility>
+#include <vector>
+
#include "cmAlgorithms.h"
#include "cmCTestBuildAndTestHandler.h"
#include "cmCTestBuildHandler.h"
@@ -21,35 +42,15 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmVersionConfig.h"
#include "cmXMLWriter.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <cm_auto_ptr.hxx>
-#include <cm_curl.h>
-#include <cm_zlib.h>
-#include <cmsys/Base64.h>
-#include <cmsys/Directory.hxx>
-#include <cmsys/FStream.hxx>
-#include <cmsys/Glob.hxx>
-#include <cmsys/Process.h>
-#include <cmsys/String.hxx>
-#include <cmsys/SystemInformation.hxx>
-#include <ctype.h>
-#include <iostream>
-#include <map>
-#include <sstream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <string>
-#include <time.h>
-#include <utility>
-#include <vector>
-
#if defined(__BEOS__) || defined(__HAIKU__)
#include <be/kernel/OS.h> /* disable_debugger() API. */
#endif
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index e84012c5b8..cb0ba63a6d 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -2,11 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCacheManager.h"
-#include "cmGeneratedFileStream.h"
-#include "cmSystemTools.h"
-#include "cmVersion.h"
-#include "cmake.h"
-
#include <algorithm>
#include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx>
@@ -14,6 +9,12 @@
#include <stdio.h>
#include <string.h>
+#include "cmGeneratedFileStream.h"
+#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmVersion.h"
+#include "cmake.h"
+
cmCacheManager::cmCacheManager()
{
this->CacheMajorVersion = 0;
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 90731f5708..e82c9ef3ee 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -5,9 +5,6 @@
#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmPropertyMap.h"
-#include "cmState.h"
-
#include <iosfwd>
#include <map>
#include <set>
@@ -15,6 +12,9 @@
#include <utility>
#include <vector>
+#include "cmPropertyMap.h"
+#include "cmStateTypes.h"
+
class cmake;
/** \class cmCacheManager
diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h
index 50af2e2950..b19b0f928c 100644
--- a/Source/cmCommandArgumentsHelper.h
+++ b/Source/cmCommandArgumentsHelper.h
@@ -5,10 +5,12 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
+#include <set>
+#include <string>
+#include <vector>
-class cmCommandArgumentsHelper;
class cmCommandArgumentGroup;
+class cmCommandArgumentsHelper;
/* cmCommandArgumentsHelper, cmCommandArgumentGroup and cmCommandArgument (i.e.
its derived classes cmCAXXX can be used to simplify the processing of
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 95b95c146b..c3a925f163 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCommonTargetGenerator.h"
-#include <algorithm>
#include <cmConfigure.h>
#include <set>
#include <sstream>
@@ -16,8 +15,8 @@
#include "cmLocalCommonGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmOutputConverter.h"
#include "cmSourceFile.h"
-#include "cmStateDirectory.h"
#include "cmStateTypes.h"
cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index fe27038006..bdd6645ff5 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -4,19 +4,16 @@
#define cmCommonTargetGenerator_h
#include <cmConfigure.h> // IWYU pragma: keep
-
-#include "cmOutputConverter.h"
-
#include <map>
#include <string>
#include <vector>
class cmGeneratorTarget;
class cmGlobalCommonGenerator;
+class cmLinkLineComputer;
class cmLocalCommonGenerator;
class cmMakefile;
class cmSourceFile;
-class cmLinkLineComputer;
/** \class cmCommonTargetGenerator
* \brief Common infrastructure for Makefile and Ninja per-target generators
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 71d6c4ea0c..f2eb6019b0 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -2,12 +2,22 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmConditionEvaluator.h"
+#include <algorithm>
+#include <cmConfigure.h>
+#include <cmsys/RegularExpression.hxx>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "cmAlgorithms.h"
#include "cmMakefile.h"
-#include "cmOutputConverter.h"
#include "cmState.h"
#include "cmSystemTools.h"
+class cmCommand;
+class cmTest;
+
static std::string const keyAND = "AND";
static std::string const keyCOMMAND = "COMMAND";
static std::string const keyDEFINED = "DEFINED";
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
index 3c9d2cda9f..5815177d56 100644
--- a/Source/cmConditionEvaluator.h
+++ b/Source/cmConditionEvaluator.h
@@ -3,12 +3,18 @@
#ifndef cmConditionEvaluator_h
#define cmConditionEvaluator_h
-#include "cmCommand.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <list>
+#include <string>
+#include <vector>
+
#include "cmExpandedCommandArgument.h"
#include "cmListFileCache.h"
+#include "cmPolicies.h"
#include "cmake.h"
-#include <list>
+class cmMakefile;
class cmConditionEvaluator
{
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index b7d2196231..3b46fc0cfa 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -2,16 +2,24 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCoreTryCompile.h"
+#include <cmConfigure.h>
+#include <cmsys/Directory.hxx>
+#include <set>
+#include <sstream>
+#include <stdio.h>
+#include <string.h>
+
#include "cmAlgorithms.h"
#include "cmExportTryCompileFileGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
+#include "cmPolicies.h"
#include "cmState.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmVersion.h"
#include "cmake.h"
-#include <cmsys/Directory.hxx>
-
-#include <assert.h>
static std::string const kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN =
"CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN";
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index 0d9bb7921b..1c94f0970b 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -3,6 +3,11 @@
#ifndef cmCoreTryCompile_h
#define cmCoreTryCompile_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
#include "cmStateTypes.h"
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 14a6c88c86..69532e61b1 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -2,10 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCreateTestSourceList.h"
+#include <algorithm>
+
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
+class cmExecutionStatus;
+
// cmCreateTestSourceList
bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 2f71a00643..5e003cfc18 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -3,8 +3,15 @@
#ifndef cmCreateTestSourceList_h
#define cmCreateTestSourceList_h
+#include <cmConfigure.h>
+
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
+class cmExecutionStatus;
+
/** \class cmCreateTestSourceList
* \brief Test driver generation command
*
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 0b459f9344..47fe76a6b9 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -3,6 +3,7 @@
#include "cmDefinitions.h"
#include <assert.h>
+#include <cmConfigure.h>
#include <set>
#include <utility>
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 8dfb9eab59..ad406653d0 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -3,14 +3,14 @@
#ifndef cmDefinitions_h
#define cmDefinitions_h
-#include <cmConfigure.h>
-
-#include "cmLinkedTree.h"
-#include "cm_unordered_map.hxx"
+#include <cmConfigure.h> // IWYU pragma: keep
#include <string>
#include <vector>
+#include "cmLinkedTree.h"
+#include "cm_unordered_map.hxx"
+
/** \class cmDefinitions
* \brief Store a scope of variable definitions for CMake language.
*
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 84ab072273..e6000dbac3 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -2,16 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmDependsC.h"
+#include <cmsys/FStream.hxx>
+#include <utility>
+
#include "cmAlgorithms.h"
#include "cmFileTimeComparison.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmOutputConverter.h"
#include "cmSystemTools.h"
-#include <cmsys/FStream.hxx>
-#include <utility>
-
#define INCLUDE_REGEX_LINE \
"^[ \t]*#[ \t]*(include|import)[ \t]*[<\"]([^\">]+)([\">])"
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index c8723d0b00..7927402af2 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -2,14 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmDependsFortran.h"
-#include "cmFortranParser.h" /* Interface to parser object. */
-#include "cmGeneratedFileStream.h"
-#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
-#include "cmOutputConverter.h"
-#include "cmStateDirectory.h"
-#include "cmSystemTools.h"
-
#include <assert.h>
#include <cmsys/FStream.hxx>
#include <iostream>
@@ -18,6 +10,15 @@
#include <string.h>
#include <utility>
+#include "cmFortranParser.h" /* Interface to parser object. */
+#include "cmGeneratedFileStream.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmOutputConverter.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
+#include "cmSystemTools.h"
+
// TODO: Test compiler for the case of the mod file. Some always
// use lower case and some always use upper case. I do not know if any
// use the case from the source code.
diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h
index 1597ea7673..71b939ce66 100644
--- a/Source/cmDependsJavaParserHelper.h
+++ b/Source/cmDependsJavaParserHelper.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+class cmDependsJavaParserHelper;
+
#define YYSTYPE cmDependsJavaParserHelper::ParserType
#define YYSTYPE_IS_DECLARED
#define YY_EXTRA_TYPE cmDependsJavaParserHelper*
diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h
index 7d4e97cedc..fd3c416af8 100644
--- a/Source/cmExecutionStatus.h
+++ b/Source/cmExecutionStatus.h
@@ -3,10 +3,6 @@
#ifndef cmExecutionStatus_h
#define cmExecutionStatus_h
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
-
/** \class cmExecutionStatus
* \brief Superclass for all command status classes
*
diff --git a/Source/cmExpandedCommandArgument.h b/Source/cmExpandedCommandArgument.h
index 39cffcecc3..9770fe68c4 100644
--- a/Source/cmExpandedCommandArgument.h
+++ b/Source/cmExpandedCommandArgument.h
@@ -3,9 +3,9 @@
#ifndef cmExpandedCommandArgument_h
#define cmExpandedCommandArgument_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmStandardIncludes.h"
+#include <string>
/** \class cmExpandedCommandArgument
* \brief Represents an expanded command argument
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 38f95d222a..dab0c2c8c4 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -2,14 +2,22 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportBuildAndroidMKGenerator.h"
-#include "cmExportSet.h"
+#include <algorithm>
+#include <map>
+#include <sstream>
+#include <utility>
+
+#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
-#include "cmGlobalGenerator.h"
+#include "cmLinkItem.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmTargetExport.h"
-
-#include <algorithm>
+#include "cmPolicies.h"
+#include "cmStateTypes.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
cmExportBuildAndroidMKGenerator::cmExportBuildAndroidMKGenerator()
{
diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h
index c9e0145afb..2a5a42e763 100644
--- a/Source/cmExportBuildAndroidMKGenerator.h
+++ b/Source/cmExportBuildAndroidMKGenerator.h
@@ -3,10 +3,16 @@
#ifndef cmExportBuildAndroidMKGenerator_h
#define cmExportBuildAndroidMKGenerator_h
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+
#include "cmExportBuildFileGenerator.h"
-#include "cmListFileCache.h"
+#include "cmExportFileGenerator.h"
-class cmExportSet;
+class cmGeneratorTarget;
/** \class cmExportBuildAndroidMKGenerator
* \brief Generate a file exporting targets from a build tree.
diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx
index 206978565c..9772f49850 100644
--- a/Source/cmExportInstallAndroidMKGenerator.cxx
+++ b/Source/cmExportInstallAndroidMKGenerator.cxx
@@ -2,16 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportInstallAndroidMKGenerator.h"
-#include "cmAlgorithms.h"
+#include <ostream>
+#include <stddef.h>
+
#include "cmExportBuildAndroidMKGenerator.h"
#include "cmExportSet.h"
-#include "cmExportSetMap.h"
-#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
-#include "cmGlobalGenerator.h"
#include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h"
-#include "cmLocalGenerator.h"
+#include "cmStateTypes.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
#include "cmTargetExport.h"
cmExportInstallAndroidMKGenerator::cmExportInstallAndroidMKGenerator(
diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h
index c713027b91..f2f8927f79 100644
--- a/Source/cmExportInstallAndroidMKGenerator.h
+++ b/Source/cmExportInstallAndroidMKGenerator.h
@@ -3,10 +3,18 @@
#ifndef cmExportInstallAndroidMKGenerator_h
#define cmExportInstallAndroidMKGenerator_h
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <set>
+#include <string>
+#include <vector>
+
+#include "cmExportFileGenerator.h"
#include "cmExportInstallFileGenerator.h"
+class cmGeneratorTarget;
class cmInstallExportGenerator;
-class cmInstallTargetGenerator;
/** \class cmExportInstallAndroidMKGenerator
* \brief Generate a file exporting targets from an install tree.
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 41fc4281b4..b0a4c47187 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -2,6 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExtraCodeBlocksGenerator.h"
+#include <map>
+#include <ostream>
+#include <string.h>
+#include <utility>
+
#include "cmAlgorithms.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
@@ -14,12 +19,6 @@
#include "cmXMLWriter.h"
#include "cmake.h"
-#include <algorithm>
-#include <map>
-#include <ostream>
-#include <string.h>
-#include <utility>
-
/* Some useful URLs:
Homepage:
http://www.codeblocks.org
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index c4e86a9eab..ff2703e7ed 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -2,13 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExtraEclipseCDT4Generator.h"
+#include <algorithm>
+#include <assert.h>
+#include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <sstream>
+#include <stdio.h>
+#include <utility>
+
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmOutputConverter.h"
#include "cmSourceFile.h"
#include "cmSourceGroup.h"
#include "cmState.h"
@@ -17,14 +24,6 @@
#include "cmXMLWriter.h"
#include "cmake.h"
-#include <algorithm>
-#include <assert.h>
-#include <cmsys/RegularExpression.hxx>
-#include <map>
-#include <sstream>
-#include <stdio.h>
-#include <utility>
-
static void AppendAttribute(cmXMLWriter& xml, const char* keyval)
{
xml.StartElement("attribute");
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 9ef684d011..5712ab235f 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -2,7 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExtraSublimeTextGenerator.h"
+#include <cmsys/RegularExpression.hxx>
+#include <set>
+#include <sstream>
+#include <string.h>
+#include <utility>
+
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
@@ -10,12 +17,7 @@
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-
-#include <cmsys/RegularExpression.hxx>
-#include <ostream>
-#include <set>
-#include <string.h>
-#include <utility>
+#include "cmake.h"
/*
Sublime Text 2 Generator
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 1bade57746..afff0f3cf6 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -20,6 +20,7 @@
#undef GetCurrentDirectory
#include <assert.h>
+#include <stdlib.h>
#include <sys/types.h>
// include sys/stat.h after sys/types.h
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx
index 55d8c2a132..991ebb8c78 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeComparison.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFileTimeComparison.h"
-#include <cmConfigure.h>
#include <string>
#include <time.h>
#include <utility>
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 3d67ac102a..dce502113c 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -2,8 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFindBase.h"
+#include <cmConfigure.h>
+#include <iostream>
+#include <map>
+#include <stddef.h>
+
#include "cmAlgorithms.h"
#include "cmMakefile.h"
+#include "cmSearchPath.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index 2b8d4a2ad2..423d4533c4 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -3,6 +3,11 @@
#ifndef cmFindBase_h
#define cmFindBase_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
#include "cmFindCommon.h"
/** \class cmFindBase
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 75d1453d6c..110195c4fc 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -2,12 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFindCommon.h"
+#include <algorithm>
+#include <string.h>
+#include <utility>
+
#include "cmMakefile.h"
#include "cmSystemTools.h"
-#include <algorithm>
-#include <functional>
-
cmFindCommon::PathGroup cmFindCommon::PathGroup::All("ALL");
cmFindCommon::PathLabel cmFindCommon::PathLabel::CMake("CMAKE");
cmFindCommon::PathLabel cmFindCommon::PathLabel::CMakeEnvironment(
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 1809c0a83f..4d6d569c19 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -3,10 +3,19 @@
#ifndef cmFindCommon_h
#define cmFindCommon_h
+#include <cmConfigure.h>
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
#include "cmPathLabel.h"
#include "cmSearchPath.h"
+class cmMakefile;
+
/** \class cmFindCommon
* \brief Base class for FIND_XXX implementations.
*
diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h
index 388115d250..b3450b3f27 100644
--- a/Source/cmFunctionBlocker.h
+++ b/Source/cmFunctionBlocker.h
@@ -3,12 +3,9 @@
#ifndef cmFunctionBlocker_h
#define cmFunctionBlocker_h
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
-
-#include "cmExecutionStatus.h"
#include "cmListFileCache.h"
+
+class cmExecutionStatus;
class cmMakefile;
class cmFunctionBlocker
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 0ba575a011..31adcb71b7 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFunctionCommand.h"
-#include <algorithm>
#include <sstream>
#include "cmAlgorithms.h"
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 6cdb7f5408..4731493747 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -2,11 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGeneratedFileStream.h"
-#include "cmSystemTools.h"
-
#include <stdio.h>
+#include "cmSystemTools.h"
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
+#include "cm_codecvt.hxx"
#include <cm_zlib.h>
#endif
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 34f763c741..1f2d2b4c09 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGeneratorExpression.h"
+#include <cmsys/RegularExpression.hxx>
+#include <utility>
+
#include "assert.h"
#include "cmAlgorithms.h"
#include "cmGeneratorExpressionContext.h"
@@ -9,9 +12,7 @@
#include "cmGeneratorExpressionLexer.h"
#include "cmGeneratorExpressionParser.h"
#include "cmSystemTools.h"
-
-#include <cmsys/RegularExpression.hxx>
-#include <utility>
+#include "cm_auto_ptr.hxx"
cmGeneratorExpression::cmGeneratorExpression(
const cmListFileBacktrace& backtrace)
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index c6c4c3ac81..aeb005fdd5 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -2,6 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionEvaluationFile.h"
+#include <cmConfigure.h>
+#include <cmsys/FStream.hxx>
+#include <sstream>
+#include <utility>
+
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmListFileCache.h"
@@ -9,13 +14,9 @@
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <cmConfigure.h>
-#include <cmsys/FStream.hxx>
-#include <sstream>
-#include <utility>
-
cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
const std::string& input,
CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr,
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index d597270e7a..26135df211 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -5,14 +5,19 @@
#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmGeneratorExpression.h"
-
-#include <cm_auto_ptr.hxx>
#include <map>
#include <string>
-#include <sys/types.h>
#include <vector>
+#include "cmGeneratorExpression.h"
+#include "cm_auto_ptr.hxx"
+
+#if defined(_MSC_VER)
+typedef unsigned short mode_t;
+#else
+#include <sys/types.h>
+#endif
+
class cmLocalGenerator;
class cmGeneratorExpressionEvaluationFile
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index ca056c05f7..882de85097 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2,6 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGeneratorTarget.h"
+#include <algorithm>
+#include <assert.h>
+#include <cmsys/RegularExpression.hxx>
+#include <errno.h>
+#include <iterator>
+#include <queue>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommand.h"
@@ -24,16 +35,7 @@
#include "cm_unordered_set.hxx"
#include "cmake.h"
-#include <algorithm>
-#include <assert.h>
-#include <cmsys/RegularExpression.hxx>
-#include <errno.h>
-#include <iterator>
-#include <queue>
-#include <sstream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+class cmMessenger;
template <>
const char* cmTargetPropertyComputer::GetSources<cmGeneratorTarget>(
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index c92ae2180c..7962da6018 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetCMakePropertyCommand.h"
-#include <algorithm>
#include <set>
#include "cmAlgorithms.h"
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index a0a33eac9c..d2372a766d 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalBorlandMakefileGenerator.h"
+#include "cmDocumentationEntry.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmState.h"
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cf51c6a239..2d0767f639 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -9,6 +9,16 @@
#include "cmGlobalGenerator.h"
+#include <algorithm>
+#include <assert.h>
+#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "cmAlgorithms.h"
#include "cmCPackPropertiesGenerator.h"
#include "cmComputeTargetDepends.h"
@@ -29,20 +39,11 @@
#include "cmQtAutoGeneratorInitializer.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
#include "cmStateTypes.h"
#include "cmVersion.h"
#include "cmake.h"
-#include <algorithm>
-#include <assert.h>
-#include <cmsys/Directory.hxx>
-#include <cmsys/FStream.hxx>
-#include <iterator>
-#include <sstream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include <cm_jsoncpp_value.h>
#include <cm_jsoncpp_writer.h>
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 4bf4bd1e9e..88ef8da3f8 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -5,8 +5,15 @@
#include <cmConfigure.h>
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "cmCustomCommandLines.h"
#include "cmExportSetMap.h"
-#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -14,26 +21,19 @@
#include "cm_codecvt.hxx"
#include "cm_unordered_map.hxx"
-#include <iosfwd>
-#include <map>
-#include <set>
-#include <string>
-#include <utility>
-#include <vector>
-
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmFileLockPool.h"
#endif
-class cmCustomCommandLines;
-class cmSourceFile;
class cmExportBuildFileGenerator;
class cmExternalMakefileProjectGenerator;
class cmGeneratorTarget;
-class cmLocalGenerator;
class cmLinkLineComputer;
+class cmLocalGenerator;
class cmMakefile;
class cmOutputConverter;
+class cmSourceFile;
+class cmStateDirectory;
class cmake;
/** \class cmGlobalGenerator
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index 528e1184a9..5e948f7603 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -5,12 +5,11 @@
#include <cmConfigure.h>
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <string>
+#include <vector>
-class cmake;
class cmGlobalGenerator;
+class cmake;
struct cmDocumentationEntry;
/** \class cmGlobalGeneratorFactory
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index 78bf5bd3d1..18c45e0d86 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalJOMMakefileGenerator.h"
+#include "cmDocumentationEntry.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmState.h"
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index f17b915226..7e0d0d4555 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -2,11 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalMSYSMakefileGenerator.h"
+#include <cmsys/FStream.hxx>
+
+#include "cmDocumentationEntry.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmState.h"
#include "cmake.h"
-#include <cmsys/FStream.hxx>
cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index 255c0f5a75..3c3a5d1dcb 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalMinGWMakefileGenerator.h"
+#include "cmDocumentationEntry.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmState.h"
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index 06aba737d3..da683fb39f 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalNMakeMakefileGenerator.h"
+#include "cmDocumentationEntry.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmState.h"
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 830ab7f5e7..f62c8ecbc2 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -2,6 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalNinjaGenerator.h"
+#include <algorithm>
+#include <cm_jsoncpp_reader.h>
+#include <cm_jsoncpp_value.h>
+#include <cm_jsoncpp_writer.h>
+#include <cmsys/FStream.hxx>
+#include <ctype.h>
+#include <functional>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
+
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include "cmFortranParser.h"
@@ -13,6 +24,9 @@
#include "cmMakefile.h"
#include "cmNinjaLinkLineComputer.h"
#include "cmOutputConverter.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -21,15 +35,7 @@
#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_writer.h"
-
-#include <algorithm>
-#include <ctype.h>
-#include <functional>
-#include <iterator>
-#include <sstream>
-#include <stdio.h>
+class cmLinkLineComputer;
const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja";
const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja";
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 064ff0b3bf..a51e919453 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -5,12 +5,6 @@
#include <cmConfigure.h>
-#include "cmGlobalCommonGenerator.h"
-#include "cmGlobalGenerator.h"
-#include "cmGlobalGeneratorFactory.h"
-#include "cmNinjaTypes.h"
-#include "cmPolicies.h"
-
#include <iosfwd>
#include <map>
#include <set>
@@ -18,13 +12,23 @@
#include <utility>
#include <vector>
+#include "cmGlobalCommonGenerator.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
+#include "cmNinjaTypes.h"
+#include "cmPolicies.h"
+#include "cm_codecvt.hxx"
+
class cmCustomCommand;
-class cmMakefile;
-class cmake;
-struct cmDocumentationEntry;
class cmGeneratedFileStream;
class cmGeneratorTarget;
+class cmLinkLineComputer;
class cmLocalGenerator;
+class cmMakefile;
+class cmOutputConverter;
+class cmStateDirectory;
+class cmake;
+struct cmDocumentationEntry;
/**
* \class cmGlobalNinjaGenerator
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 90caaf9b9d..23b3718dc2 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -2,6 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalUnixMakefileGenerator3.h"
+#include <algorithm>
+#include <functional>
+#include <sstream>
+#include <utility>
+
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include "cmGeneratedFileStream.h"
@@ -14,16 +19,12 @@
#include "cmOutputConverter.h"
#include "cmState.h"
#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmake.h"
-#include <algorithm>
-#include <functional>
-#include <sstream>
-#include <utility>
-
cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm)
: cmGlobalCommonGenerator(cm)
{
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 843e5dcfcb..67d7bc9eac 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -5,11 +5,6 @@
#include <cmConfigure.h>
-#include "cmGeneratorTarget.h"
-#include "cmGlobalCommonGenerator.h"
-#include "cmGlobalGeneratorFactory.h"
-#include "cmStateTypes.h"
-
#include <iosfwd>
#include <map>
#include <set>
@@ -17,6 +12,11 @@
#include <string>
#include <vector>
+#include "cmGeneratorTarget.h"
+#include "cmGlobalCommonGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
+#include "cmStateSnapshot.h"
+
class cmGeneratedFileStream;
class cmLocalGenerator;
class cmLocalUnixMakefileGenerator3;
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 0900797a65..94cdb38486 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -5,7 +5,6 @@
#include "cmDocumentationEntry.h"
#include "cmMakefile.h"
#include "cmState.h"
-#include "cmStateTypes.h"
#include "cmake.h"
cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h
index a154373cc6..e6aec47c2b 100644
--- a/Source/cmGraphAdjacencyList.h
+++ b/Source/cmGraphAdjacencyList.h
@@ -3,9 +3,9 @@
#ifndef cmGraphAdjacencyList_h
#define cmGraphAdjacencyList_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmStandardIncludes.h"
+#include <vector>
/**
* Graph edge representation. Most use cases just need the
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 6b32f73c3a..0f69aaa465 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -2,21 +2,22 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGraphVizWriter.h"
+#include <cmConfigure.h>
+#include <iostream>
+#include <sstream>
+#include <utility>
+
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <cmConfigure.h>
-#include <iostream>
-#include <sstream>
-#include <utility>
-
static const char* getShapeForTarget(const cmGeneratorTarget* target)
{
if (!target) {
diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx
index db855d2c9b..d9d6598936 100644
--- a/Source/cmHexFileConverter.cxx
+++ b/Source/cmHexFileConverter.cxx
@@ -2,11 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmHexFileConverter.h"
-#include "cmSystemTools.h"
-
+#include <cmConfigure.h>
#include <stdio.h>
#include <string.h>
+#include "cmSystemTools.h"
+
#define INTEL_HEX_MIN_LINE_LENGTH (1 + 8 + 2)
#define INTEL_HEX_MAX_LINE_LENGTH (1 + 8 + (256 * 2) + 2)
#define MOTOROLA_SREC_MIN_LINE_LENGTH (2 + 2 + 4 + 2)
diff --git a/Source/cmHexFileConverter.h b/Source/cmHexFileConverter.h
index cb550bb453..1050bc1b47 100644
--- a/Source/cmHexFileConverter.h
+++ b/Source/cmHexFileConverter.h
@@ -3,10 +3,6 @@
#ifndef cmHexFileConverter_h
#define cmHexFileConverter_h
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
-
/** \class cmHexFileConverter
* \brief Can detects Intel Hex and Motorola S-record files and convert them
* to binary files.
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index bf59e881da..fadebb474e 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallCommand.h"
-#include <algorithm>
#include <cmsys/Glob.hxx>
#include <sstream>
#include <stddef.h>
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index de6919b83b..6b1546868d 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallCommandArguments.h"
+#include <cmConfigure.h>
+
#include "cmSystemTools.h"
// Table of valid permissions.
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index 82c231025e..c1523b2356 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -3,9 +3,10 @@
#ifndef cmInstallCommandArguments_h
#define cmInstallCommandArguments_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmStandardIncludes.h"
+#include <string>
+#include <vector>
#include "cmCommandArgumentsHelper.h"
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index f1df073adb..4dfa40f0ee 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -2,6 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallTargetGenerator.h"
+#include <assert.h>
+#include <map>
+#include <set>
+#include <sstream>
+#include <utility>
+
#include "cmComputeLinkInformation.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
@@ -12,15 +18,8 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
-#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <assert.h>
-#include <map>
-#include <set>
-#include <sstream>
-#include <utility>
-
cmInstallTargetGenerator::cmInstallTargetGenerator(
const std::string& targetName, const char* dest, bool implib,
const char* file_permissions, std::vector<std::string> const& configurations,
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index 74d67740db..6fd6f500fb 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -3,8 +3,16 @@
#ifndef cmLinkItem_h
#define cmLinkItem_h
+#include <cmConfigure.h>
+
+#include <algorithm>
+#include <map>
+#include <string>
+#include <vector>
+
#include "cmListFileCache.h"
#include "cmSystemTools.h"
+#include "cmTargetLinkLibraryType.h"
class cmGeneratorTarget;
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index c271246269..cf0cf88a4e 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -2,10 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLinkLineComputer.h"
+
+#include <sstream>
+#include <vector>
+
#include "cmComputeLinkInformation.h"
#include "cmGeneratorTarget.h"
#include "cmOutputConverter.h"
#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir)
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index 6bbb69e596..97a5d1bbbd 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -4,6 +4,10 @@
#ifndef cmLinkLineComputer_h
#define cmLinkLineComputer_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+
#include "cmStateDirectory.h"
class cmComputeLinkInformation;
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index d2c6f33892..4f95522603 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -5,9 +5,9 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
-
#include <assert.h>
+#include <iterator>
+#include <vector>
/**
@brief A adaptor for traversing a tree structure in a vector
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 6b49f1e71f..d5f9d27cd3 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -2,10 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLocalCommonGenerator.h"
+#include <vector>
+
#include "cmGeneratorTarget.h"
#include "cmMakefile.h"
-
-#include <vector>
+#include "cmOutputConverter.h"
class cmGlobalGenerator;
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index eb5f850bac..f83f3713e2 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -5,11 +5,10 @@
#include <cmConfigure.h>
-#include "cmLocalGenerator.h"
-#include "cmOutputConverter.h"
-
#include <string>
+#include "cmLocalGenerator.h"
+
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmMakefile;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 4aecb1d1a7..7d3a2f0d02 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -18,6 +18,7 @@
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTestGenerator.h"
@@ -32,10 +33,10 @@
#include <algorithm>
#include <assert.h>
#include <cmsys/RegularExpression.hxx>
-#include <ctype.h>
#include <iterator>
#include <sstream>
#include <stdio.h>
+#include <string.h>
#include <utility>
#if defined(__HAIKU__)
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 6314affe74..fdca78afa0 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -5,29 +5,28 @@
#include <cmConfigure.h>
-#include "cmListFileCache.h"
-#include "cmOutputConverter.h"
-#include "cmPolicies.h"
-#include "cmRulePlaceholderExpander.h"
-#include "cmStateTypes.h"
-#include "cmake.h"
-
#include <cm_kwiml.h>
#include <iosfwd>
#include <map>
#include <set>
-#include <string.h>
#include <string>
#include <vector>
+#include "cmListFileCache.h"
+#include "cmOutputConverter.h"
+#include "cmPolicies.h"
+#include "cmStateSnapshot.h"
+#include "cmake.h"
+
class cmComputeLinkInformation;
class cmCustomCommandGenerator;
class cmGeneratorTarget;
class cmGlobalGenerator;
-class cmRulePlaceholderExpander;
+class cmLinkLineComputer;
class cmMakefile;
+class cmRulePlaceholderExpander;
class cmSourceFile;
-class cmLinkLineComputer;
+class cmState;
/** \class cmLocalGenerator
* \brief Create required build files for a directory.
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index c27ab0993d..c2d9d575e3 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -2,6 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLocalNinjaGenerator.h"
+#include <algorithm>
+#include <assert.h>
+#include <iterator>
+#include <sstream>
+#include <stdio.h>
+#include <utility>
+
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratedFileStream.h"
@@ -15,15 +22,9 @@
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <algorithm>
-#include <assert.h>
-#include <iterator>
-#include <sstream>
-#include <stdio.h>
-#include <utility>
-
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
cmMakefile* mf)
: cmLocalCommonGenerator(gg, mf, mf->GetState()->GetBinaryDirectory())
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 95d8eb8777..10803196f5 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -5,17 +5,16 @@
#include <cmConfigure.h>
-#include "cmLocalCommonGenerator.h"
-#include "cmLocalGenerator.h"
-#include "cmNinjaTypes.h"
-#include "cmOutputConverter.h"
-
#include <iosfwd>
#include <map>
#include <set>
#include <string>
#include <vector>
+#include "cmLocalCommonGenerator.h"
+#include "cmNinjaTypes.h"
+#include "cmOutputConverter.h"
+
class cmCustomCommand;
class cmCustomCommandGenerator;
class cmGeneratedFileStream;
@@ -23,6 +22,7 @@ class cmGeneratorTarget;
class cmGlobalGenerator;
class cmGlobalNinjaGenerator;
class cmMakefile;
+class cmRulePlaceholderExpander;
class cmSourceFile;
class cmake;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 4f81ef19a2..8bb084a829 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2,6 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLocalUnixMakefileGenerator3.h"
+#include <algorithm>
+#include <cmsys/FStream.hxx>
+#include <cmsys/Terminal.h>
+#include <functional>
+#include <sstream>
+#include <stdio.h>
+#include <utility>
+
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
@@ -18,9 +26,11 @@
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
// Include dependency scanners for supported languages. Only the
@@ -31,15 +41,6 @@
#include "cmDependsJava.h"
#endif
-#include <algorithm>
-#include <cm_auto_ptr.hxx>
-#include <cmsys/FStream.hxx>
-#include <cmsys/Terminal.h>
-#include <functional>
-#include <sstream>
-#include <stdio.h>
-#include <utility>
-
// Escape special characters in Makefile dependency lines
class cmMakeSafe
{
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
index f35e52844f..e8e751d1d9 100644
--- a/Source/cmLocale.h
+++ b/Source/cmLocale.h
@@ -5,8 +5,6 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
-
#include <locale.h>
class cmLocaleRAII
diff --git a/Source/cmMSVC60LinkLineComputer.cxx b/Source/cmMSVC60LinkLineComputer.cxx
index 9308d91120..d761e7ba0d 100644
--- a/Source/cmMSVC60LinkLineComputer.cxx
+++ b/Source/cmMSVC60LinkLineComputer.cxx
@@ -3,7 +3,13 @@
#include "cmMSVC60LinkLineComputer.h"
+#include "cmStateDirectory.h"
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
#include "cmSystemTools.h"
+#endif
+
+class cmOutputConverter;
cmMSVC60LinkLineComputer::cmMSVC60LinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory stateDir)
diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h
index 381b8a2cbd..9a28dca0d5 100644
--- a/Source/cmMSVC60LinkLineComputer.h
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -4,8 +4,15 @@
#ifndef cmMSVC60LinkLineComputer_h
#define cmMSVC60LinkLineComputer_h
+#include <cmConfigure.h>
+
+#include <string>
+
#include "cmLinkLineComputer.h"
+class cmOutputConverter;
+class cmStateDirectory;
+
class cmMSVC60LinkLineComputer : public cmLinkLineComputer
{
public:
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index d777bd5425..583f801800 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMacroCommand.h"
-#include <algorithm>
#include <sstream>
#include <stdio.h>
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 741ffb8577..90182f9f9d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2,6 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefile.h"
+#include <algorithm>
+#include <assert.h>
+#include <cmsys/FStream.hxx>
+#include <cmsys/RegularExpression.hxx>
+#include <ctype.h>
+#include <sstream>
+#include <stdlib.h>
+#include <string.h>
+#include <utility>
+
#include "cmAlgorithms.h"
#include "cmCommand.h"
#include "cmCommandArgumentParserHelper.h"
@@ -14,6 +24,7 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmGlobalGenerator.h"
+#include "cmInstallGenerator.h" // IWYU pragma: keep
#include "cmListFileCache.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
@@ -21,28 +32,17 @@
#include "cmStateDirectory.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cmTargetLinkLibraryType.h"
#include "cmTest.h"
+#include "cmTestGenerator.h" // IWYU pragma: keep
#include "cmVersion.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include "cmInstallGenerator.h" // IWYU pragma: keep
-#include "cmTestGenerator.h" // IWYU pragma: keep
-
#ifdef CMAKE_BUILD_WITH_CMAKE
#include "cmVariableWatch.h"
#endif
-#include <algorithm>
-#include <assert.h>
-#include <cm_auto_ptr.hxx>
-#include <cmsys/FStream.hxx>
-#include <cmsys/RegularExpression.hxx>
-#include <ctype.h>
-#include <sstream>
-#include <stdlib.h>
-#include <string.h>
-#include <utility>
-
class cmMessenger;
// default is not to be building executables
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 3067f2cf73..859b3c8d21 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -5,13 +5,21 @@
#include <cmConfigure.h>
+#include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <set>
+#include <stack>
+#include <string>
+#include <vector>
+
#include "cmAlgorithms.h"
#include "cmListFileCache.h"
#include "cmNewLineStyle.h"
#include "cmPolicies.h"
#include "cmStateSnapshot.h"
+#include "cmStateTypes.h"
#include "cmTarget.h"
-#include "cmTargetLinkLibraryType.h"
+#include "cm_auto_ptr.hxx"
#include "cm_unordered_map.hxx"
#include "cmake.h"
@@ -19,15 +27,6 @@
#include "cmSourceGroup.h"
#endif
-#include <cm_auto_ptr.hxx>
-#include <cmsys/RegularExpression.hxx>
-
-#include <map>
-#include <set>
-#include <stack>
-#include <string>
-#include <vector>
-
class cmCommand;
class cmCompiledGeneratorExpression;
class cmCustomCommandLines;
@@ -40,6 +39,7 @@ class cmGlobalGenerator;
class cmInstallGenerator;
class cmMessenger;
class cmSourceFile;
+class cmState;
class cmTest;
class cmTestGenerator;
class cmVariableWatch;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index cbbd2e6c61..358804e2c5 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -2,6 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileExecutableTargetGenerator.h"
+#include <sstream>
+#include <string>
+#include <vector>
+
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
@@ -13,13 +17,12 @@
#include "cmOutputConverter.h"
#include "cmRulePlaceholderExpander.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <sstream>
-#include <string>
-#include <vector>
-
cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator(
cmGeneratorTarget* target)
: cmMakefileTargetGenerator(target)
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index a249efda4e..c591bb3f3b 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -2,6 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileLibraryTargetGenerator.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <sstream>
+#include <vector>
+
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
@@ -13,13 +18,13 @@
#include "cmOutputConverter.h"
#include "cmRulePlaceholderExpander.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <sstream>
-#include <vector>
-
cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
cmGeneratorTarget* target)
: cmMakefileTargetGenerator(target)
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 68aabefc04..5bec2bbcb9 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -2,6 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileTargetGenerator.h"
+#include <sstream>
+#include <stdio.h>
+#include <utility>
+
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommand.h"
@@ -10,8 +14,6 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
-#include "cmLinkLineComputer.h"
-#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmMakefileExecutableTargetGenerator.h"
@@ -21,17 +23,13 @@
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <algorithm>
-#include <ctype.h>
-#include <sstream>
-#include <stdio.h>
-#include <utility>
-
#ifndef _WIN32
#include <unistd.h>
#endif
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index e44f64a1e2..347f9f2ba9 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -5,22 +5,24 @@
#include <cmConfigure.h>
-#include "cmCommonTargetGenerator.h"
-#include "cmLocalUnixMakefileGenerator3.h"
-#include "cmOSXBundleGenerator.h"
-
#include <iosfwd>
#include <map>
#include <set>
#include <string>
#include <vector>
+#include "cmCommonTargetGenerator.h"
+#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmOSXBundleGenerator.h"
+
class cmCustomCommandGenerator;
class cmGeneratedFileStream;
class cmGeneratorTarget;
class cmGlobalUnixMakefileGenerator3;
-class cmSourceFile;
class cmLinkLineComputer;
+class cmOutputConverter;
+class cmSourceFile;
+class cmStateDirectory;
/** \class cmMakefileTargetGenerator
* \brief Support Routines for writing makefiles
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index ecb29cba39..a7c5d27f25 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -2,17 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileUtilityTargetGenerator.h"
+#include <ostream>
+#include <string>
+#include <vector>
+
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmOSXBundleGenerator.h"
-#include "cmOutputConverter.h"
-
-#include <ostream>
-#include <string>
-#include <vector>
+#include "cmSystemTools.h"
cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator(
cmGeneratorTarget* target)
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 2e157206ea..43fb5f54cc 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMessageCommand.h"
-#include <algorithm>
-
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessenger.h"
diff --git a/Source/cmNinjaLinkLineComputer.cxx b/Source/cmNinjaLinkLineComputer.cxx
index fa9df6d475..2546b555ff 100644
--- a/Source/cmNinjaLinkLineComputer.cxx
+++ b/Source/cmNinjaLinkLineComputer.cxx
@@ -2,7 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmNinjaLinkLineComputer.h"
+
#include "cmGlobalNinjaGenerator.h"
+#include "cmStateDirectory.h"
+
+class cmOutputConverter;
cmNinjaLinkLineComputer::cmNinjaLinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory stateDir,
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
index daecea4fa6..ff0771b828 100644
--- a/Source/cmNinjaLinkLineComputer.h
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -4,10 +4,15 @@
#ifndef cmNinjaLinkLineComputer_h
#define cmNinjaLinkLineComputer_h
+#include <cmConfigure.h>
+
+#include <string>
+
#include "cmLinkLineComputer.h"
-#include "cmState.h"
class cmGlobalNinjaGenerator;
+class cmOutputConverter;
+class cmStateDirectory;
class cmNinjaLinkLineComputer : public cmLinkLineComputer
{
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index d70bf8ec29..a23e0adf63 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -2,6 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmNinjaNormalTargetGenerator.h"
+#include <algorithm>
+#include <assert.h>
+#include <iterator>
+#include <limits>
+#include <map>
+#include <set>
+#include <sstream>
+#include <stddef.h>
+
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
@@ -18,19 +27,13 @@
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <algorithm>
-#include <assert.h>
-#include <iterator>
-#include <limits>
-#include <map>
-#include <set>
-#include <sstream>
-#include <stddef.h>
-
#ifndef _WIN32
#include <unistd.h>
#endif
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index cf6089209c..a220cd87c9 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -2,10 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmNinjaTargetGenerator.h"
+#include <algorithm>
+#include <assert.h>
+#include <cm_jsoncpp_value.h>
+#include <cm_jsoncpp_writer.h>
+#include <iterator>
+#include <map>
+#include <sstream>
+#include <string.h>
+
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
#include "cmLocalGenerator.h"
@@ -19,16 +29,9 @@
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include "cm_jsoncpp_writer.h"
-
-#include <algorithm>
-#include <iterator>
-#include <map>
-#include <sstream>
-#include <string.h>
-
cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
{
switch (target->GetType()) {
diff --git a/Source/cmNinjaTypes.h b/Source/cmNinjaTypes.h
index b4eaa593bc..3fd536ab45 100644
--- a/Source/cmNinjaTypes.h
+++ b/Source/cmNinjaTypes.h
@@ -3,9 +3,11 @@
#ifndef cmNinjaTypes_h
#define cmNinjaTypes_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmStandardIncludes.h"
+#include <map>
+#include <string>
+#include <vector>
typedef std::vector<std::string> cmNinjaDeps;
typedef std::map<std::string, std::string> cmNinjaVars;
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index bbd6090943..00a2d2bce9 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -2,8 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmOptionCommand.h"
-#include <algorithm>
-
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmState.h"
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 445ad0bf6c..d6864a6188 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -2,16 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmOutputConverter.h"
-#include "cmAlgorithms.h"
-#include "cmState.h"
-#include "cmStateDirectory.h"
-#include "cmSystemTools.h"
-
#include <algorithm>
#include <assert.h>
#include <ctype.h>
#include <set>
#include <sstream>
+#include <vector>
+
+#include "cmAlgorithms.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmSystemTools.h"
cmOutputConverter::cmOutputConverter(cmStateSnapshot snapshot)
: StateSnapshot(snapshot)
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index dabb09117b..a3da4cd169 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -5,10 +5,12 @@
#include <cmConfigure.h> // IWYU pragma: keep
+#include <string>
+
#include "cmStateSnapshot.h"
-#include <string>
-#include <vector>
+class cmState;
+class cmStateDirectory;
class cmOutputConverter
{
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index 0a2dd12fee..d75ee8e862 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmParseArgumentsCommand.h"
-#include <algorithm>
#include <map>
#include <set>
#include <sstream>
diff --git a/Source/cmPathLabel.cxx b/Source/cmPathLabel.cxx
index 19e6820c71..30ba081514 100644
--- a/Source/cmPathLabel.cxx
+++ b/Source/cmPathLabel.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmPathLabel.h"
+#include <stddef.h>
+
cmPathLabel::cmPathLabel(const std::string& label)
: Label(label)
, Hash(0)
diff --git a/Source/cmPathLabel.h b/Source/cmPathLabel.h
index 5e9e423cfe..cd9743c70c 100644
--- a/Source/cmPathLabel.h
+++ b/Source/cmPathLabel.h
@@ -3,9 +3,9 @@
#ifndef cmPathLabel_h
#define cmPathLabel_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmStandardIncludes.h"
+#include <string>
/** \class cmPathLabel
* \brief Helper class for text based labels
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index f0373a159f..8afd532337 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -13,7 +13,6 @@
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmState.h"
-#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -27,7 +26,6 @@
#include <cmConfigure.h>
#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
-#include <iostream>
#include <map>
#include <set>
#include <sstream>
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index f56f575815..499da3a962 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -2,18 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQtAutoGenerators.h"
-#include "cmAlgorithms.h"
-#include "cmFilePathUuid.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
-#include "cmOutputConverter.h"
-#include "cmState.h"
-#include "cmStateDirectory.h"
-#include "cmStateTypes.h"
-#include "cmSystemTools.h"
-#include "cm_auto_ptr.hxx"
-#include "cmake.h"
-
#include <algorithm>
#include <assert.h>
#include <cmConfigure.h>
@@ -26,6 +14,17 @@
#include <string.h>
#include <utility>
+#include "cmAlgorithms.h"
+#include "cmFilePathUuid.h"
+#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmOutputConverter.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
+#include "cmSystemTools.h"
+#include "cm_auto_ptr.hxx"
+#include "cmake.h"
+
#if defined(__APPLE__)
#include <unistd.h>
#endif
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index 75ac54d655..f190a5c359 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -2,6 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmRulePlaceholderExpander.h"
+#include <ctype.h>
+#include <string.h>
+#include <utility>
+
#include "cmOutputConverter.h"
#include "cmSystemTools.h"
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index 444419c8e0..5223ae95e1 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -9,7 +9,6 @@
#include <map>
#include <string>
-class cmGeneratorTarget;
class cmOutputConverter;
class cmRulePlaceholderExpander
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index ff0b8363a5..0df6e0c06b 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -2,7 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSearchPath.h"
+#include <algorithm>
#include <cassert>
+#include <utility>
#include "cmAlgorithms.h"
#include "cmFindCommon.h"
diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h
index 80815ed361..9ffa87125b 100644
--- a/Source/cmSearchPath.h
+++ b/Source/cmSearchPath.h
@@ -5,7 +5,9 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
+#include <set>
+#include <string>
+#include <vector>
class cmFindCommon;
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 51a363f034..5a71dc01fd 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -14,6 +14,7 @@
#include "cm_jsoncpp_value.h"
#endif
+#include <algorithm>
#include <fstream>
#include <iostream>
#include <memory>
diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx
index b4af52b456..008052b246 100644
--- a/Source/cmServerConnection.cxx
+++ b/Source/cmServerConnection.cxx
@@ -8,6 +8,7 @@
#include "cmServer.h"
#include <assert.h>
+#include <string.h>
namespace {
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index e49f142fd2..820e7f695c 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetCommand.h"
-#include <algorithm>
#include <string.h>
#include "cmAlgorithms.h"
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 6f29b18f74..5c4f18b407 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -2,17 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSourceFile.h"
+#include <sstream>
+
#include "cmCustomCommand.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmProperty.h"
#include "cmState.h"
-#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
-#include <sstream>
-
cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name)
: Location(mf, name)
{
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index db1e542866..6e934e21c7 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -2,24 +2,22 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmState.h"
-#include "cmStatePrivate.h"
+#include <algorithm>
+#include <assert.h>
+#include <cmsys/RegularExpression.hxx>
+#include <string.h>
+#include <utility>
#include "cmAlgorithms.h"
#include "cmCacheManager.h"
#include "cmCommand.h"
#include "cmDefinitions.h"
#include "cmListFileCache.h"
+#include "cmStatePrivate.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmake.h"
-#include <algorithm>
-#include <assert.h>
-#include <cmsys/RegularExpression.hxx>
-#include <iterator>
-#include <stdio.h>
-#include <string.h>
-#include <utility>
-
cmState::cmState()
: IsInTryCompile(false)
, WindowsShell(false)
diff --git a/Source/cmState.h b/Source/cmState.h
index 6d74815858..41ffcdcd2d 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -5,25 +5,22 @@
#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmAlgorithms.h"
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
#include "cmDefinitions.h"
#include "cmLinkedTree.h"
#include "cmProperty.h"
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
+#include "cmStatePrivate.h"
#include "cmStateTypes.h"
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
class cmCacheManager;
class cmCommand;
-class cmListFileBacktrace;
class cmPropertyDefinition;
-
-class cmStateDirectory;
class cmStateSnapshot;
class cmState
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 01e1e7e908..46a1858484 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -2,8 +2,18 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmStateDirectory.h"
+
+#include <algorithm>
+#include <assert.h>
+#include <iterator>
+#include <map>
+#include <utility>
+
+#include "cmProperty.h"
+#include "cmPropertyMap.h"
#include "cmState.h"
#include "cmStatePrivate.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
static std::string const kBINARY_DIR = "BINARY_DIR";
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
index 17a89d894e..8accc8e113 100644
--- a/Source/cmStateDirectory.h
+++ b/Source/cmStateDirectory.h
@@ -10,9 +10,10 @@
#include <vector>
#include "cmAlgorithms.h"
+#include "cmLinkedTree.h"
#include "cmListFileCache.h"
+#include "cmStatePrivate.h"
#include "cmStateSnapshot.h"
-#include "cmStateTypes.h"
class cmStateDirectory
{
diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h
index 8daa3cf355..20700f2b3d 100644
--- a/Source/cmStatePrivate.h
+++ b/Source/cmStatePrivate.h
@@ -12,9 +12,16 @@
#include "cmDefinitions.h"
#include "cmLinkedTree.h"
#include "cmListFileCache.h"
+#include "cmPolicies.h"
#include "cmPropertyMap.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+namespace cmStateDetail {
+struct BuildsystemDirectoryStateType;
+struct PolicyStackEntry;
+} // namespace cmStateDetail
+
static const std::string cmPropertySentinal = std::string();
struct cmStateDetail::SnapshotDataType
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index 7f86221e2c..c6288a56e4 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -3,13 +3,25 @@
#include "cmStateSnapshot.h"
+#include <algorithm>
+#include <assert.h>
+#include <iterator>
+#include <stdio.h>
+
+#include "cmAlgorithms.h"
+#include "cmDefinitions.h"
+#include "cmListFileCache.h"
+#include "cmPropertyMap.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStatePrivate.h"
-#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmake.h"
+#if defined(__CYGWIN__)
+#include "cmSystemTools.h"
+#endif
+
cmStateSnapshot::cmStateSnapshot(cmState* state)
: State(state)
, Position()
diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h
index 63b581d595..72d0349b00 100644
--- a/Source/cmStateSnapshot.h
+++ b/Source/cmStateSnapshot.h
@@ -6,10 +6,10 @@
#include <cmConfigure.h> // IWYU pragma: keep
-#include <map>
#include <string>
#include <vector>
+#include "cmLinkedTree.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
diff --git a/Source/cmStateTypes.h b/Source/cmStateTypes.h
index 75f9e60399..2c974c1dc0 100644
--- a/Source/cmStateTypes.h
+++ b/Source/cmStateTypes.h
@@ -4,12 +4,12 @@
#ifndef cmStateTypes_h
#define cmStateTypes_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
#include "cmLinkedTree.h"
namespace cmStateDetail {
-struct BuildsystemDirectoryStateType;
struct SnapshotDataType;
-struct PolicyStackEntry;
typedef cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator PositionType;
}
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 512bc9131f..f83544552d 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmStringCommand.h"
-#include <algorithm>
#include <cmsys/RegularExpression.hxx>
#include <ctype.h>
#include <sstream>
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 9817a3c9d1..0801f26ba7 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -11,6 +11,12 @@
#include <string>
#include <vector>
+#if defined(_MSC_VER)
+typedef unsigned short mode_t;
+#else
+#include <sys/types.h>
+#endif
+
class cmSystemToolsFileTime;
/** \class cmSystemTools
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 25ae3398af..dabdda5c74 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2,6 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTarget.h"
+#include <algorithm>
+#include <assert.h>
+#include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <set>
+#include <sstream>
+#include <string.h>
+
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
@@ -14,19 +22,13 @@
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmTargetPropertyComputer.h"
#include "cm_unordered_set.hxx"
#include "cmake.h"
-#include <algorithm>
-#include <assert.h>
-#include <cmsys/RegularExpression.hxx>
-#include <map>
-#include <set>
-#include <sstream>
-#include <string.h>
-
template <>
const char* cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>(
cmTarget const* tgt)
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 1f035a16e8..57ef8d2358 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -5,6 +5,13 @@
#include <cmConfigure.h> // IWYU pragma: keep
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmListFileCache.h"
@@ -14,16 +21,10 @@
#include "cmTargetLinkLibraryType.h"
#include "cm_unordered_map.hxx"
-#include <iosfwd>
-#include <map>
-#include <set>
-#include <string>
-#include <utility>
-#include <vector>
-
+class cmGlobalGenerator;
class cmMakefile;
+class cmMessenger;
class cmSourceFile;
-class cmGlobalGenerator;
class cmTargetInternals;
class cmTargetInternalPointer
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index a1c9b824df..1b6c008877 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetCompileFeaturesCommand.h"
-#include <algorithm>
#include <sstream>
#include "cmAlgorithms.h"
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index a4db55b41b..1b4056d761 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetCompileOptionsCommand.h"
-#include <algorithm>
#include <sstream>
#include "cmAlgorithms.h"
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index acea6ea186..a953efb2aa 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -3,9 +3,9 @@
#ifndef cmTargetDepend_h
#define cmTargetDepend_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmStandardIncludes.h"
+#include <set>
class cmGeneratorTarget;
diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h
index 634148bbbf..b08ede289b 100644
--- a/Source/cmTargetExport.h
+++ b/Source/cmTargetExport.h
@@ -3,13 +3,13 @@
#ifndef cmTargetExport_h
#define cmTargetExport_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmStandardIncludes.h"
+#include <string>
class cmGeneratorTarget;
-class cmInstallTargetGenerator;
class cmInstallFilesGenerator;
+class cmInstallTargetGenerator;
/** \brief A member of an ExportSet
*
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 7aba0f85d3..9a5c1da247 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -4,6 +4,9 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmStateTypes.h"
+#include "cmTarget.h"
+#include "cmake.h"
bool cmTargetPropCommandBase::HandleArguments(
std::vector<std::string> const& args, const std::string& prop,
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index 485a7f377e..8b49653cdd 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -3,6 +3,11 @@
#ifndef cmTargetPropCommandBase_h
#define cmTargetPropCommandBase_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
#include "cmCommand.h"
class cmTarget;
diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx
index 7cf1fd8172..04931af557 100644
--- a/Source/cmTargetPropertyComputer.cxx
+++ b/Source/cmTargetPropertyComputer.cxx
@@ -3,14 +3,13 @@
#include "cmTargetPropertyComputer.h"
-#include "cmGeneratorTarget.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
+#include <sstream>
+
#include "cmMessenger.h"
-#include "cmSourceFile.h"
-#include "cmSourceFileLocation.h"
-#include "cmTarget.h"
+#include "cmPolicies.h"
+#include "cmStateSnapshot.h"
#include "cm_unordered_set.hxx"
+#include "cmake.h"
bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
std::string const& tgtName, cmMessenger* messenger,
diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h
index 798958961f..45d31be3bc 100644
--- a/Source/cmTargetPropertyComputer.h
+++ b/Source/cmTargetPropertyComputer.h
@@ -5,14 +5,13 @@
#include <cmConfigure.h> // IWYU pragma: keep
+#include <string>
+
#include "cmAlgorithms.h"
#include "cmListFileCache.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include <map>
-#include <string>
-
-class cmTarget;
class cmMessenger;
class cmTargetPropertyComputer
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index 13c9a8f783..058659a52b 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetSourcesCommand.h"
-#include <algorithm>
#include <sstream>
#include "cmAlgorithms.h"
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 1c36dc6378..4d0cbaafcc 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -5,7 +5,6 @@
#include "cmMakefile.h"
#include "cmProperty.h"
#include "cmState.h"
-#include "cmStateTypes.h"
#include "cmSystemTools.h"
cmTest::cmTest(cmMakefile* mf)
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 843f7b12e1..4164f3a81f 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -2,6 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTestGenerator.h"
+#include <map>
+#include <ostream>
+#include <utility>
+
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmLocalGenerator.h"
@@ -11,11 +15,6 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTest.h"
-#include "cm_auto_ptr.hxx"
-
-#include <map>
-#include <ostream>
-#include <utility>
cmTestGenerator::cmTestGenerator(
cmTest* test, std::vector<std::string> const& configurations)
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index 9597e093a4..589f195e9d 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -2,15 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTimestamp.h"
-#include "cmSystemTools.h"
-
-#include <cstdlib>
+#include <cmConfigure.h>
#include <cstring>
#include <sstream>
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h>
+#include "cmSystemTools.h"
std::string cmTimestamp::CurrentTime(const std::string& formatString,
bool utcFlag)
diff --git a/Source/cmTimestamp.h b/Source/cmTimestamp.h
index 44e397b76d..fdee564012 100644
--- a/Source/cmTimestamp.h
+++ b/Source/cmTimestamp.h
@@ -3,9 +3,7 @@
#ifndef cmTimestamp_h
#define cmTimestamp_h
-#include <cmConfigure.h>
-
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include <string>
#include <time.h>
diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx
index 5f16bd8402..fcd9954320 100644
--- a/Source/cm_codecvt.hxx
+++ b/Source/cm_codecvt.hxx
@@ -3,10 +3,11 @@
#ifndef cm_codecvt_hxx
#define cm_codecvt_hxx
-#include <cmConfigure.h> // IWYU pragma: keep
+#include <cmConfigure.h>
#include <locale>
#include <vector>
+#include <wchar.h>
class codecvt : public std::codecvt<char, char, mbstate_t>
{
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index eb76ca0309..6c066c6d04 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -17,6 +17,7 @@
#include "cmMakefile.h"
#include "cmMessenger.h"
#include "cmState.h"
+#include "cmStateDirectory.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
@@ -25,11 +26,11 @@
#include "cm_auto_ptr.hxx"
#if defined(CMAKE_BUILD_WITH_CMAKE)
+#include <cm_jsoncpp_writer.h>
+
#include "cmGraphVizWriter.h"
#include "cmVariableWatch.h"
#include "cm_unordered_map.hxx"
-
-#include <cm_jsoncpp_writer.h>
#endif
// only build kdevelop generator on non-windows platforms
diff --git a/Source/cmake.h b/Source/cmake.h
index 6e8d9c81e5..0f1891d12c 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -5,17 +5,18 @@
#include <cmConfigure.h>
-#include "cmInstalledFile.h"
-#include "cmListFileCache.h"
-#include "cmStateSnapshot.h"
-
#include <map>
#include <set>
#include <string>
#include <vector>
+#include "cmInstalledFile.h"
+#include "cmListFileCache.h"
+#include "cmStateSnapshot.h"
+#include "cmStateTypes.h"
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
-#include "cm_jsoncpp_value.h"
+#include <cm_jsoncpp_value.h>
#endif
class cmExternalMakefileProjectGeneratorFactory;
@@ -24,6 +25,7 @@ class cmGlobalGenerator;
class cmGlobalGeneratorFactory;
class cmMakefile;
class cmMessenger;
+class cmState;
class cmVariableWatch;
struct cmDocumentationEntry;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 44af96607e..a974061d0c 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -12,6 +12,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include "cmcmd.h"
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index c008791899..1db147a6e6 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -8,6 +8,7 @@
#include "cmMakefile.h"
#include "cmQtAutoGenerators.h"
#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmUtils.hxx"
#include "cmVersion.h"