Просмотр исходного кода

Merge topic 'split-cmState'

e6eecec7 cmListFileCache: Remove cmState header include
e3587ee0 cmTargetPropertyComputer: Add missing include
e0a84904 cmState: Split auxiliary classes into separate files
a91eaf38 cmState: Port dependents to new cmStateTypes header
27be1d81 cmState: Move extracted declarations to a separate file
34433c88 cmState: Remove compatibility typedefs
cde6eb62 cmState: Port dependent code to new cmStateSnapshot name
a9bf981a cmState: Move Snapshot type to separate namespace
17d27893 cmState: Port dependent code to new cmStateDirectory name
34bcec39 cmState: Move Directory class to separate namespace
2fe3e55d cmState: Move CacheEntryType enum to separate namespace
a49751fb cmState: Move TargetType enum to separate namespace
0060391d cmState: Move SnapshotType enum to separate namespace
5bc964ed cmState: Move PositionType to separate namespace
2dc40996 cmState: Move PolicyStackEntry to separate namespace
cb40af5d cmState: Move SnapshotDataType to separate namespace
...
Brad King 9 лет назад
Родитель
Сommit
92c3cab223
100 измененных файлов с 805 добавлено и 734 удалено
  1. 5 0
      Source/CMakeLists.txt
  2. 1 1
      Source/CPack/cmCPackGenerator.cxx
  3. 1 0
      Source/CPack/cpack.cxx
  4. 1 1
      Source/CTest/cmCTestLaunch.cxx
  5. 2 1
      Source/CTest/cmCTestScriptHandler.cxx
  6. 1 0
      Source/CTest/cmCTestSubmitHandler.cxx
  7. 1 0
      Source/CTest/cmCTestTestHandler.cxx
  8. 2 2
      Source/CursesDialog/cmCursesBoolWidget.cxx
  9. 6 5
      Source/CursesDialog/cmCursesCacheEntryComposite.cxx
  10. 2 2
      Source/CursesDialog/cmCursesDummyWidget.cxx
  11. 2 2
      Source/CursesDialog/cmCursesFilePathWidget.cxx
  12. 17 15
      Source/CursesDialog/cmCursesMainForm.cxx
  13. 2 2
      Source/CursesDialog/cmCursesMainForm.h
  14. 2 2
      Source/CursesDialog/cmCursesOptionsWidget.cxx
  15. 3 3
      Source/CursesDialog/cmCursesPathWidget.cxx
  16. 2 2
      Source/CursesDialog/cmCursesStringWidget.cxx
  17. 3 3
      Source/CursesDialog/cmCursesWidget.h
  18. 13 13
      Source/QtDialog/QCMake.cxx
  19. 3 3
      Source/cmAddExecutableCommand.cxx
  20. 33 31
      Source/cmAddLibraryCommand.cxx
  21. 1 1
      Source/cmBuildCommand.cxx
  22. 2 2
      Source/cmBuildNameCommand.cxx
  23. 2 1
      Source/cmCMakePolicyCommand.cxx
  24. 11 11
      Source/cmCPluginAPI.cxx
  25. 2 1
      Source/cmCTest.cxx
  26. 17 17
      Source/cmCacheManager.cxx
  27. 13 6
      Source/cmCacheManager.h
  28. 3 2
      Source/cmCommonTargetGenerator.cxx
  29. 3 3
      Source/cmComputeLinkDepends.cxx
  30. 24 22
      Source/cmComputeLinkInformation.cxx
  31. 11 10
      Source/cmComputeTargetDepends.cxx
  32. 1 0
      Source/cmConditionEvaluator.cxx
  33. 21 19
      Source/cmCoreTryCompile.cxx
  34. 1 1
      Source/cmCoreTryCompile.h
  35. 4 4
      Source/cmCustomCommandGenerator.cxx
  36. 1 0
      Source/cmDefinePropertyCommand.cxx
  37. 1 0
      Source/cmDependsFortran.cxx
  38. 12 12
      Source/cmExportBuildAndroidMKGenerator.cxx
  39. 5 5
      Source/cmExportBuildFileGenerator.cxx
  40. 2 2
      Source/cmExportCommand.cxx
  41. 10 10
      Source/cmExportFileGenerator.cxx
  42. 1 1
      Source/cmExportInstallAndroidMKGenerator.cxx
  43. 4 4
      Source/cmExportInstallFileGenerator.cxx
  44. 2 2
      Source/cmExportLibraryDependenciesCommand.cxx
  45. 2 2
      Source/cmExportTryCompileFileGenerator.cxx
  46. 22 22
      Source/cmExtraCodeBlocksGenerator.cxx
  47. 17 17
      Source/cmExtraCodeLiteGenerator.cxx
  48. 20 16
      Source/cmExtraEclipseCDT4Generator.cxx
  49. 8 8
      Source/cmExtraKateGenerator.cxx
  50. 8 8
      Source/cmExtraSublimeTextGenerator.cxx
  51. 2 1
      Source/cmFindBase.cxx
  52. 4 3
      Source/cmFindLibraryCommand.cxx
  53. 2 1
      Source/cmFindPackageCommand.cxx
  54. 4 3
      Source/cmFindPathCommand.cxx
  55. 3 3
      Source/cmFindProgramCommand.cxx
  56. 10 10
      Source/cmGeneratorExpressionNode.cxx
  57. 96 94
      Source/cmGeneratorTarget.cxx
  58. 3 3
      Source/cmGeneratorTarget.h
  59. 1 1
      Source/cmGetCMakePropertyCommand.cxx
  60. 6 6
      Source/cmGetFilenameComponentCommand.cxx
  61. 1 0
      Source/cmGetPropertyCommand.cxx
  62. 4 4
      Source/cmGhsMultiTargetGenerator.cxx
  63. 1 0
      Source/cmGlobalBorlandMakefileGenerator.cxx
  64. 28 27
      Source/cmGlobalGenerator.cxx
  65. 6 5
      Source/cmGlobalGenerator.h
  66. 1 0
      Source/cmGlobalJOMMakefileGenerator.cxx
  67. 2 2
      Source/cmGlobalKdevelopGenerator.cxx
  68. 1 0
      Source/cmGlobalMSYSMakefileGenerator.cxx
  69. 1 0
      Source/cmGlobalMinGWMakefileGenerator.cxx
  70. 1 0
      Source/cmGlobalNMakeMakefileGenerator.cxx
  71. 22 21
      Source/cmGlobalNinjaGenerator.cxx
  72. 1 1
      Source/cmGlobalNinjaGenerator.h
  73. 43 37
      Source/cmGlobalUnixMakefileGenerator3.cxx
  74. 3 3
      Source/cmGlobalUnixMakefileGenerator3.h
  75. 3 2
      Source/cmGlobalVisualStudio11Generator.cxx
  76. 1 1
      Source/cmGlobalVisualStudio11Generator.h
  77. 1 1
      Source/cmGlobalVisualStudio71Generator.cxx
  78. 1 1
      Source/cmGlobalVisualStudio71Generator.h
  79. 8 7
      Source/cmGlobalVisualStudio7Generator.cxx
  80. 1 1
      Source/cmGlobalVisualStudio7Generator.h
  81. 5 5
      Source/cmGlobalVisualStudio8Generator.cxx
  82. 2 2
      Source/cmGlobalVisualStudio8Generator.h
  83. 12 10
      Source/cmGlobalVisualStudioGenerator.cxx
  84. 1 0
      Source/cmGlobalWatcomWMakeGenerator.cxx
  85. 70 69
      Source/cmGlobalXCodeGenerator.cxx
  86. 9 9
      Source/cmGraphVizWriter.cxx
  87. 2 2
      Source/cmGraphVizWriter.h
  88. 3 3
      Source/cmIncludeExternalMSProjectCommand.cxx
  89. 13 13
      Source/cmInstallCommand.cxx
  90. 23 23
      Source/cmInstallTargetGenerator.cxx
  91. 4 2
      Source/cmLinkLineComputer.cxx
  92. 3 3
      Source/cmLinkLineComputer.h
  93. 4 3
      Source/cmListFileCache.cxx
  94. 6 6
      Source/cmListFileCache.h
  95. 1 1
      Source/cmLoadCacheCommand.cxx
  96. 36 34
      Source/cmLocalGenerator.cxx
  97. 3 3
      Source/cmLocalGenerator.h
  98. 1 1
      Source/cmLocalGhsMultiGenerator.cxx
  99. 2 1
      Source/cmLocalNinjaGenerator.cxx
  100. 11 9
      Source/cmLocalUnixMakefileGenerator3.cxx

+ 5 - 0
Source/CMakeLists.txt

@@ -360,6 +360,11 @@ set(SRCS
   cmSourceGroup.h
   cmState.cxx
   cmState.h
+  cmStateDirectory.cxx
+  cmStateDirectory.h
+  cmStateSnapshot.cxx
+  cmStateSnapshot.h
+  cmStateTypes.h
   cmSystemTools.cxx
   cmSystemTools.h
   cmTarget.cxx

+ 1 - 1
Source/CPack/cmCPackGenerator.cxx

@@ -8,7 +8,7 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmXMLSafe.h"
 #include "cm_auto_ptr.hxx"
 #include "cmake.h"

+ 1 - 0
Source/CPack/cpack.cxx

@@ -10,6 +10,7 @@
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTypeMacro.h"
 #include "cm_auto_ptr.hxx"

+ 1 - 1
Source/CTest/cmCTestLaunch.cxx

@@ -7,7 +7,7 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmXMLWriter.h"
 #include "cmake.h"

+ 2 - 1
Source/CTest/cmCTestScriptHandler.cxx

@@ -22,6 +22,7 @@
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
@@ -280,7 +281,7 @@ void cmCTestScriptHandler::CreateCMake()
   this->CMake->AddCMakePaths();
   this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
 
-  cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot();
+  cmStateSnapshot snapshot = this->CMake->GetCurrentSnapshot();
   std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
   snapshot.GetDirectory().SetCurrentSource(cwd);
   snapshot.GetDirectory().SetCurrentBinary(cwd);

+ 1 - 0
Source/CTest/cmCTestSubmitHandler.cxx

@@ -8,6 +8,7 @@
 #include "cmCurl.h"
 #include "cmGeneratedFileStream.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmXMLParser.h"
 #include "cmake.h"

+ 1 - 0
Source/CTest/cmCTestTestHandler.cxx

@@ -10,6 +10,7 @@
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmXMLWriter.h"
 #include "cm_auto_ptr.hxx"

+ 2 - 2
Source/CursesDialog/cmCursesBoolWidget.cxx

@@ -3,7 +3,7 @@
 #include "cmCursesBoolWidget.h"
 
 #include "cmCursesWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 #include <string>
 
@@ -11,7 +11,7 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left,
                                        int top)
   : cmCursesWidget(width, height, left, top)
 {
-  this->Type = cmState::BOOL;
+  this->Type = cmStateEnums::BOOL;
   set_field_fore(this->Field, A_NORMAL);
   set_field_back(this->Field, A_STANDOUT);
   field_opts_off(this->Field, O_STATIC);

+ 6 - 5
Source/CursesDialog/cmCursesCacheEntryComposite.cxx

@@ -10,6 +10,7 @@
 #include "cmCursesStringWidget.h"
 #include "cmCursesWidget.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
@@ -47,7 +48,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
   const char* value = cm->GetState()->GetCacheEntryValue(key);
   assert(value);
   switch (cm->GetState()->GetCacheEntryType(key)) {
-    case cmState::BOOL:
+    case cmStateEnums::BOOL:
       this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
       if (cmSystemTools::IsOn(value)) {
         static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
@@ -55,15 +56,15 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
         static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(false);
       }
       break;
-    case cmState::PATH:
+    case cmStateEnums::PATH:
       this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1);
       static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value);
       break;
-    case cmState::FILEPATH:
+    case cmStateEnums::FILEPATH:
       this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1);
       static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value);
       break;
-    case cmState::STRING: {
+    case cmStateEnums::STRING: {
       const char* stringsProp =
         cm->GetState()->GetCacheEntryProperty(key, "STRINGS");
       if (stringsProp) {
@@ -83,7 +84,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
       }
       break;
     }
-    case cmState::UNINITIALIZED:
+    case cmStateEnums::UNINITIALIZED:
       cmSystemTools::Error("Found an undefined variable: ", key.c_str());
       break;
     default:

+ 2 - 2
Source/CursesDialog/cmCursesDummyWidget.cxx

@@ -3,13 +3,13 @@
 #include "cmCursesDummyWidget.h"
 
 #include "cmCursesWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left,
                                          int top)
   : cmCursesWidget(width, height, left, top)
 {
-  this->Type = cmState::INTERNAL;
+  this->Type = cmStateEnums::INTERNAL;
 }
 
 bool cmCursesDummyWidget::HandleInput(int& /*key*/, cmCursesMainForm* /*fm*/,

+ 2 - 2
Source/CursesDialog/cmCursesFilePathWidget.cxx

@@ -3,11 +3,11 @@
 #include "cmCursesFilePathWidget.h"
 
 #include "cmCursesPathWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, int left,
                                                int top)
   : cmCursesPathWidget(width, height, left, top)
 {
-  this->Type = cmState::FILEPATH;
+  this->Type = cmStateEnums::FILEPATH;
 }

+ 17 - 15
Source/CursesDialog/cmCursesMainForm.cxx

@@ -12,6 +12,7 @@
 #include "cmCursesStringWidget.h"
 #include "cmCursesWidget.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmVersion.h"
 #include "cmake.h"
@@ -106,10 +107,10 @@ void cmCursesMainForm::InitializeUI()
 
   for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
        it != cacheKeys.end(); ++it) {
-    cmState::CacheEntryType t =
+    cmStateEnums::CacheEntryType t =
       this->CMakeInstance->GetState()->GetCacheEntryType(*it);
-    if (t != cmState::INTERNAL && t != cmState::STATIC &&
-        t != cmState::UNINITIALIZED) {
+    if (t != cmStateEnums::INTERNAL && t != cmStateEnums::STATIC &&
+        t != cmStateEnums::UNINITIALIZED) {
       ++count;
     }
   }
@@ -130,10 +131,10 @@ void cmCursesMainForm::InitializeUI()
     for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
          it != cacheKeys.end(); ++it) {
       std::string key = *it;
-      cmState::CacheEntryType t =
+      cmStateEnums::CacheEntryType t =
         this->CMakeInstance->GetState()->GetCacheEntryType(*it);
-      if (t == cmState::INTERNAL || t == cmState::STATIC ||
-          t == cmState::UNINITIALIZED) {
+      if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC ||
+          t == cmStateEnums::UNINITIALIZED) {
         continue;
       }
 
@@ -148,10 +149,10 @@ void cmCursesMainForm::InitializeUI()
     for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
          it != cacheKeys.end(); ++it) {
       std::string key = *it;
-      cmState::CacheEntryType t =
+      cmStateEnums::CacheEntryType t =
         this->CMakeInstance->GetState()->GetCacheEntryType(*it);
-      if (t == cmState::INTERNAL || t == cmState::STATIC ||
-          t == cmState::UNINITIALIZED) {
+      if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC ||
+          t == cmStateEnums::UNINITIALIZED) {
         continue;
       }
 
@@ -249,8 +250,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
     cmCursesWidget* cw =
       reinterpret_cast<cmCursesWidget*>(field_userptr(currentField));
     // If in edit mode, get out of it
-    if (cw->GetType() == cmState::STRING || cw->GetType() == cmState::PATH ||
-        cw->GetType() == cmState::FILEPATH) {
+    if (cw->GetType() == cmStateEnums::STRING ||
+        cw->GetType() == cmStateEnums::PATH ||
+        cw->GetType() == cmStateEnums::FILEPATH) {
       cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw);
       sw->SetInEdit(false);
     }
@@ -704,7 +706,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
       std::string newValue = (*this->Entries)[i]->Entry->GetValue();
       std::string fixedOldValue;
       std::string fixedNewValue;
-      cmState::CacheEntryType t =
+      cmStateEnums::CacheEntryType t =
         this->CMakeInstance->GetState()->GetCacheEntryType(cacheKey);
       this->FixValue(t, oldValue, fixedOldValue);
       this->FixValue(t, newValue, fixedNewValue);
@@ -720,14 +722,14 @@ void cmCursesMainForm::FillCacheManagerFromUI()
   }
 }
 
-void cmCursesMainForm::FixValue(cmState::CacheEntryType type,
+void cmCursesMainForm::FixValue(cmStateEnums::CacheEntryType type,
                                 const std::string& in, std::string& out) const
 {
   out = in.substr(0, in.find_last_not_of(' ') + 1);
-  if (type == cmState::PATH || type == cmState::FILEPATH) {
+  if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) {
     cmSystemTools::ConvertToUnixSlashes(out);
   }
-  if (type == cmState::BOOL) {
+  if (type == cmStateEnums::BOOL) {
     if (cmSystemTools::IsOff(out.c_str())) {
       out = "OFF";
     } else {

+ 2 - 2
Source/CursesDialog/cmCursesMainForm.h

@@ -7,7 +7,7 @@
 
 #include "cmCursesForm.h"
 #include "cmCursesStandardIncludes.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 #include <stddef.h>
 #include <string>
@@ -110,7 +110,7 @@ protected:
   // cache.
   void FillCacheManagerFromUI();
   // Fix formatting of values to a consistent form.
-  void FixValue(cmState::CacheEntryType type, const std::string& in,
+  void FixValue(cmStateEnums::CacheEntryType type, const std::string& in,
                 std::string& out) const;
   // Re-post the existing fields. Used to toggle between
   // normal and advanced modes. Render() should be called

+ 2 - 2
Source/CursesDialog/cmCursesOptionsWidget.cxx

@@ -3,7 +3,7 @@
 #include "cmCursesOptionsWidget.h"
 
 #include "cmCursesWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 #define ctrl(z) ((z)&037)
 
@@ -11,7 +11,7 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
                                              int top)
   : cmCursesWidget(width, height, left, top)
 {
-  this->Type = cmState::BOOL; // this is a bit of a hack
+  this->Type = cmStateEnums::BOOL; // this is a bit of a hack
   // there is no option type, and string type causes ccmake to cast
   // the widget into a string widget at some point.  BOOL is safe for
   // now.

+ 3 - 3
Source/CursesDialog/cmCursesPathWidget.cxx

@@ -4,7 +4,7 @@
 
 #include "cmCursesMainForm.h"
 #include "cmCursesStringWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
 #include <vector>
@@ -13,7 +13,7 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height, int left,
                                        int top)
   : cmCursesStringWidget(width, height, left, top)
 {
-  this->Type = cmState::PATH;
+  this->Type = cmStateEnums::PATH;
   this->Cycle = false;
   this->CurrentIndex = 0;
 }
@@ -50,7 +50,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
   std::vector<std::string> dirs;
 
   cmSystemTools::SimpleGlob(glob, dirs,
-                            (this->Type == cmState::PATH ? -1 : 0));
+                            (this->Type == cmStateEnums::PATH ? -1 : 0));
   if (this->CurrentIndex < dirs.size()) {
     cstr = dirs[this->CurrentIndex];
   }

+ 2 - 2
Source/CursesDialog/cmCursesStringWidget.cxx

@@ -6,7 +6,7 @@
 #include "cmCursesMainForm.h"
 #include "cmCursesStandardIncludes.h"
 #include "cmCursesWidget.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -21,7 +21,7 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height, int left,
   : cmCursesWidget(width, height, left, top)
 {
   this->InEdit = false;
-  this->Type = cmState::STRING;
+  this->Type = cmStateEnums::STRING;
   set_field_fore(this->Field, A_NORMAL);
   set_field_back(this->Field, A_STANDOUT);
   field_opts_off(this->Field, O_STATIC);

+ 3 - 3
Source/CursesDialog/cmCursesWidget.h

@@ -6,7 +6,7 @@
 #include <cmConfigure.h> // IWYU pragma: keep
 
 #include "cmCursesStandardIncludes.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 #include <string>
 
@@ -41,7 +41,7 @@ public:
   /**
    * Get the type of the widget (STRING, PATH etc...)
    */
-  cmState::CacheEntryType GetType() { return this->Type; }
+  cmStateEnums::CacheEntryType GetType() { return this->Type; }
 
   /**
    * If there are any, print the widget specific commands
@@ -62,7 +62,7 @@ protected:
   cmCursesWidget(const cmCursesWidget& from);
   void operator=(const cmCursesWidget&);
 
-  cmState::CacheEntryType Type;
+  cmStateEnums::CacheEntryType Type;
   std::string Value;
   FIELD* Field;
   // The page in the main form this widget is in

+ 13 - 13
Source/QtDialog/QCMake.cxx

@@ -196,8 +196,8 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
   std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
   for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
        it != cacheKeys.end(); ++it) {
-    cmState::CacheEntryType t = state->GetCacheEntryType(*it);
-    if (t == cmState::INTERNAL || t == cmState::STATIC) {
+    cmStateEnums::CacheEntryType t = state->GetCacheEntryType(*it);
+    if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC) {
       continue;
     }
 
@@ -232,19 +232,19 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
     if (s.Type == QCMakeProperty::BOOL) {
       this->CMakeInstance->AddCacheEntry(
         s.Key.toLocal8Bit().data(), s.Value.toBool() ? "ON" : "OFF",
-        s.Help.toLocal8Bit().data(), cmState::BOOL);
+        s.Help.toLocal8Bit().data(), cmStateEnums::BOOL);
     } else if (s.Type == QCMakeProperty::STRING) {
       this->CMakeInstance->AddCacheEntry(
         s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
-        s.Help.toLocal8Bit().data(), cmState::STRING);
+        s.Help.toLocal8Bit().data(), cmStateEnums::STRING);
     } else if (s.Type == QCMakeProperty::PATH) {
       this->CMakeInstance->AddCacheEntry(
         s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
-        s.Help.toLocal8Bit().data(), cmState::PATH);
+        s.Help.toLocal8Bit().data(), cmStateEnums::PATH);
     } else if (s.Type == QCMakeProperty::FILEPATH) {
       this->CMakeInstance->AddCacheEntry(
         s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
-        s.Help.toLocal8Bit().data(), cmState::FILEPATH);
+        s.Help.toLocal8Bit().data(), cmStateEnums::FILEPATH);
     }
   }
 
@@ -259,9 +259,9 @@ QCMakePropertyList QCMake::properties() const
   std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
   for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
        i != cacheKeys.end(); ++i) {
-    cmState::CacheEntryType t = state->GetCacheEntryType(*i);
-    if (t == cmState::INTERNAL || t == cmState::STATIC ||
-        t == cmState::UNINITIALIZED) {
+    cmStateEnums::CacheEntryType t = state->GetCacheEntryType(*i);
+    if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC ||
+        t == cmStateEnums::UNINITIALIZED) {
       continue;
     }
 
@@ -273,14 +273,14 @@ QCMakePropertyList QCMake::properties() const
       QString::fromLocal8Bit(state->GetCacheEntryProperty(*i, "HELPSTRING"));
     prop.Value = QString::fromLocal8Bit(cachedValue);
     prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
-    if (t == cmState::BOOL) {
+    if (t == cmStateEnums::BOOL) {
       prop.Type = QCMakeProperty::BOOL;
       prop.Value = cmSystemTools::IsOn(cachedValue);
-    } else if (t == cmState::PATH) {
+    } else if (t == cmStateEnums::PATH) {
       prop.Type = QCMakeProperty::PATH;
-    } else if (t == cmState::FILEPATH) {
+    } else if (t == cmStateEnums::FILEPATH) {
       prop.Type = QCMakeProperty::FILEPATH;
-    } else if (t == cmState::STRING) {
+    } else if (t == cmStateEnums::STRING) {
       prop.Type = QCMakeProperty::STRING;
       const char* stringsProperty =
         state->GetCacheEntryProperty(*i, "STRINGS");

+ 3 - 3
Source/cmAddExecutableCommand.cxx

@@ -133,8 +133,8 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
       this->SetError(e.str());
       return false;
     }
-    cmState::TargetType type = aliasedTarget->GetType();
-    if (type != cmState::EXECUTABLE) {
+    cmStateEnums::TargetType type = aliasedTarget->GetType();
+    if (type != cmStateEnums::EXECUTABLE) {
       std::ostringstream e;
       e << "cannot create ALIAS target \"" << exename << "\" because target \""
         << aliasedName << "\" is not an "
@@ -165,7 +165,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
     }
 
     // Create the imported target.
-    this->Makefile->AddImportedTarget(exename, cmState::EXECUTABLE,
+    this->Makefile->AddImportedTarget(exename, cmStateEnums::EXECUTABLE,
                                       importGlobal);
     return true;
   }

+ 33 - 31
Source/cmAddLibraryCommand.cxx

@@ -3,6 +3,7 @@
 #include "cmAddLibraryCommand.h"
 
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmake.h"
 
 // cmLibraryCommand
@@ -15,10 +16,10 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
   }
   // Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
   // otherwise it defaults to static library.
-  cmState::TargetType type = cmState::SHARED_LIBRARY;
+  cmStateEnums::TargetType type = cmStateEnums::SHARED_LIBRARY;
   if (cmSystemTools::IsOff(
         this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
-    type = cmState::STATIC_LIBRARY;
+    type = cmStateEnums::STATIC_LIBRARY;
   }
   bool excludeFromAll = false;
   bool importTarget = false;
@@ -38,57 +39,57 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
   while (s != args.end()) {
     std::string libType = *s;
     if (libType == "STATIC") {
-      if (type == cmState::INTERFACE_LIBRARY) {
+      if (type == cmStateEnums::INTERFACE_LIBRARY) {
         std::ostringstream e;
         e << "INTERFACE library specified with conflicting STATIC type.";
         this->SetError(e.str());
         return false;
       }
       ++s;
-      type = cmState::STATIC_LIBRARY;
+      type = cmStateEnums::STATIC_LIBRARY;
       haveSpecifiedType = true;
     } else if (libType == "SHARED") {
-      if (type == cmState::INTERFACE_LIBRARY) {
+      if (type == cmStateEnums::INTERFACE_LIBRARY) {
         std::ostringstream e;
         e << "INTERFACE library specified with conflicting SHARED type.";
         this->SetError(e.str());
         return false;
       }
       ++s;
-      type = cmState::SHARED_LIBRARY;
+      type = cmStateEnums::SHARED_LIBRARY;
       haveSpecifiedType = true;
     } else if (libType == "MODULE") {
-      if (type == cmState::INTERFACE_LIBRARY) {
+      if (type == cmStateEnums::INTERFACE_LIBRARY) {
         std::ostringstream e;
         e << "INTERFACE library specified with conflicting MODULE type.";
         this->SetError(e.str());
         return false;
       }
       ++s;
-      type = cmState::MODULE_LIBRARY;
+      type = cmStateEnums::MODULE_LIBRARY;
       haveSpecifiedType = true;
     } else if (libType == "OBJECT") {
-      if (type == cmState::INTERFACE_LIBRARY) {
+      if (type == cmStateEnums::INTERFACE_LIBRARY) {
         std::ostringstream e;
         e << "INTERFACE library specified with conflicting OBJECT type.";
         this->SetError(e.str());
         return false;
       }
       ++s;
-      type = cmState::OBJECT_LIBRARY;
+      type = cmStateEnums::OBJECT_LIBRARY;
       haveSpecifiedType = true;
     } else if (libType == "UNKNOWN") {
-      if (type == cmState::INTERFACE_LIBRARY) {
+      if (type == cmStateEnums::INTERFACE_LIBRARY) {
         std::ostringstream e;
         e << "INTERFACE library specified with conflicting UNKNOWN type.";
         this->SetError(e.str());
         return false;
       }
       ++s;
-      type = cmState::UNKNOWN_LIBRARY;
+      type = cmStateEnums::UNKNOWN_LIBRARY;
       haveSpecifiedType = true;
     } else if (libType == "ALIAS") {
-      if (type == cmState::INTERFACE_LIBRARY) {
+      if (type == cmStateEnums::INTERFACE_LIBRARY) {
         std::ostringstream e;
         e << "INTERFACE library specified with conflicting ALIAS type.";
         this->SetError(e.str());
@@ -116,10 +117,10 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
         return false;
       }
       ++s;
-      type = cmState::INTERFACE_LIBRARY;
+      type = cmStateEnums::INTERFACE_LIBRARY;
       haveSpecifiedType = true;
     } else if (*s == "EXCLUDE_FROM_ALL") {
-      if (type == cmState::INTERFACE_LIBRARY) {
+      if (type == cmStateEnums::INTERFACE_LIBRARY) {
         std::ostringstream e;
         e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
         this->SetError(e.str());
@@ -133,7 +134,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
     } else if (importTarget && *s == "GLOBAL") {
       ++s;
       importGlobal = true;
-    } else if (type == cmState::INTERFACE_LIBRARY && *s == "GLOBAL") {
+    } else if (type == cmStateEnums::INTERFACE_LIBRARY && *s == "GLOBAL") {
       std::ostringstream e;
       e << "GLOBAL option may only be used with IMPORTED libraries.";
       this->SetError(e.str());
@@ -143,7 +144,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
     }
   }
 
-  if (type == cmState::INTERFACE_LIBRARY) {
+  if (type == cmStateEnums::INTERFACE_LIBRARY) {
     if (s != args.end()) {
       std::ostringstream e;
       e << "INTERFACE library requires no source arguments.";
@@ -170,7 +171,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
     bool issueMessage = false;
     switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) {
       case cmPolicies::WARN:
-        if (type != cmState::INTERFACE_LIBRARY) {
+        if (type != cmStateEnums::INTERFACE_LIBRARY) {
           e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n";
           issueMessage = true;
         }
@@ -233,12 +234,12 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
       this->SetError(e.str());
       return false;
     }
-    cmState::TargetType aliasedType = aliasedTarget->GetType();
-    if (aliasedType != cmState::SHARED_LIBRARY &&
-        aliasedType != cmState::STATIC_LIBRARY &&
-        aliasedType != cmState::MODULE_LIBRARY &&
-        aliasedType != cmState::OBJECT_LIBRARY &&
-        aliasedType != cmState::INTERFACE_LIBRARY) {
+    cmStateEnums::TargetType aliasedType = aliasedTarget->GetType();
+    if (aliasedType != cmStateEnums::SHARED_LIBRARY &&
+        aliasedType != cmStateEnums::STATIC_LIBRARY &&
+        aliasedType != cmStateEnums::MODULE_LIBRARY &&
+        aliasedType != cmStateEnums::OBJECT_LIBRARY &&
+        aliasedType != cmStateEnums::INTERFACE_LIBRARY) {
       std::ostringstream e;
       e << "cannot create ALIAS target \"" << libName << "\" because target \""
         << aliasedName << "\" is not a library.";
@@ -265,16 +266,17 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
     CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to
     STATIC. But at this point we know only the name of the target, but not
     yet its linker language. */
-  if ((type == cmState::SHARED_LIBRARY || type == cmState::MODULE_LIBRARY) &&
+  if ((type == cmStateEnums::SHARED_LIBRARY ||
+       type == cmStateEnums::MODULE_LIBRARY) &&
       (this->Makefile->GetState()->GetGlobalPropertyAsBool(
          "TARGET_SUPPORTS_SHARED_LIBS") == false)) {
     std::ostringstream w;
     w << "ADD_LIBRARY called with "
-      << (type == cmState::SHARED_LIBRARY ? "SHARED" : "MODULE")
+      << (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE")
       << " option but the target platform does not support dynamic linking. "
          "Building a STATIC library instead. This may lead to problems.";
     this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
-    type = cmState::STATIC_LIBRARY;
+    type = cmStateEnums::STATIC_LIBRARY;
   }
 
   // Handle imported target creation.
@@ -284,13 +286,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
       this->SetError("called with IMPORTED argument but no library type.");
       return false;
     }
-    if (type == cmState::OBJECT_LIBRARY) {
+    if (type == cmStateEnums::OBJECT_LIBRARY) {
       this->Makefile->IssueMessage(
         cmake::FATAL_ERROR,
         "The OBJECT library type may not be used for IMPORTED libraries.");
       return true;
     }
-    if (type == cmState::INTERFACE_LIBRARY) {
+    if (type == cmStateEnums::INTERFACE_LIBRARY) {
       if (!cmGeneratorExpression::IsValidTargetName(libName)) {
         std::ostringstream e;
         e << "Invalid name for IMPORTED INTERFACE library target: " << libName;
@@ -314,7 +316,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
   }
 
   // A non-imported target may not have UNKNOWN type.
-  if (type == cmState::UNKNOWN_LIBRARY) {
+  if (type == cmStateEnums::UNKNOWN_LIBRARY) {
     this->Makefile->IssueMessage(
       cmake::FATAL_ERROR,
       "The UNKNOWN library type may be used only for IMPORTED libraries.");
@@ -332,7 +334,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
 
   std::vector<std::string> srclists;
 
-  if (type == cmState::INTERFACE_LIBRARY) {
+  if (type == cmStateEnums::INTERFACE_LIBRARY) {
     if (!cmGeneratorExpression::IsValidTargetName(libName) ||
         libName.find("::") != std::string::npos) {
       std::ostringstream e;

+ 1 - 1
Source/cmBuildCommand.cxx

@@ -116,6 +116,6 @@ bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args)
   this->Makefile->AddCacheDefinition(define, makecommand.c_str(),
                                      "Command used to build entire project "
                                      "from the command line.",
-                                     cmState::STRING);
+                                     cmStateEnums::STRING);
   return true;
 }

+ 2 - 2
Source/cmBuildNameCommand.cxx

@@ -27,7 +27,7 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
       std::replace(cv.begin(), cv.end(), '(', '_');
       std::replace(cv.begin(), cv.end(), ')', '_');
       this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.",
-                                         cmState::STRING);
+                                         cmStateEnums::STRING);
     }
     return true;
   }
@@ -53,6 +53,6 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
   std::replace(buildname.begin(), buildname.end(), ')', '_');
 
   this->Makefile->AddCacheDefinition(args[0], buildname.c_str(),
-                                     "Name of build.", cmState::STRING);
+                                     "Name of build.", cmStateEnums::STRING);
   return true;
 }

+ 2 - 1
Source/cmCMakePolicyCommand.cxx

@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCMakePolicyCommand.h"
 
+#include "cmState.h"
 #include "cmVersion.h"
 
 // cmCMakePolicyCommand
@@ -79,7 +80,7 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector<std::string> const& args)
         "For backwards compatibility, what version of CMake "
         "commands and "
         "syntax should this version of CMake try to support.",
-        cmState::STRING);
+        cmStateEnums::STRING);
     }
   }
   return true;

+ 11 - 11
Source/cmCPluginAPI.cxx

@@ -75,22 +75,22 @@ void CCONV cmAddCacheDefinition(void* arg, const char* name, const char* value,
 
   switch (type) {
     case CM_CACHE_BOOL:
-      mf->AddCacheDefinition(name, value, doc, cmState::BOOL);
+      mf->AddCacheDefinition(name, value, doc, cmStateEnums::BOOL);
       break;
     case CM_CACHE_PATH:
-      mf->AddCacheDefinition(name, value, doc, cmState::PATH);
+      mf->AddCacheDefinition(name, value, doc, cmStateEnums::PATH);
       break;
     case CM_CACHE_FILEPATH:
-      mf->AddCacheDefinition(name, value, doc, cmState::FILEPATH);
+      mf->AddCacheDefinition(name, value, doc, cmStateEnums::FILEPATH);
       break;
     case CM_CACHE_STRING:
-      mf->AddCacheDefinition(name, value, doc, cmState::STRING);
+      mf->AddCacheDefinition(name, value, doc, cmStateEnums::STRING);
       break;
     case CM_CACHE_INTERNAL:
-      mf->AddCacheDefinition(name, value, doc, cmState::INTERNAL);
+      mf->AddCacheDefinition(name, value, doc, cmStateEnums::INTERNAL);
       break;
     case CM_CACHE_STATIC:
-      mf->AddCacheDefinition(name, value, doc, cmState::STATIC);
+      mf->AddCacheDefinition(name, value, doc, cmStateEnums::STATIC);
       break;
   }
 }
@@ -350,9 +350,9 @@ static void addLinkLibrary(cmMakefile* mf, std::string const& target,
   }
 
   cmTarget* tgt = mf->GetGlobalGenerator()->FindTarget(lib);
-  if (tgt && (tgt->GetType() != cmState::STATIC_LIBRARY) &&
-      (tgt->GetType() != cmState::SHARED_LIBRARY) &&
-      (tgt->GetType() != cmState::INTERFACE_LIBRARY) &&
+  if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) &&
+      (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) &&
+      (tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) &&
       !tgt->IsExecutableWithExports()) {
     std::ostringstream e;
     e << "Target \"" << lib << "\" of type "
@@ -393,8 +393,8 @@ void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
   for (i = 0; i < numSrcs; ++i) {
     srcs2.push_back(srcs[i]);
   }
-  mf->AddLibrary(libname,
-                 (shared ? cmState::SHARED_LIBRARY : cmState::STATIC_LIBRARY),
+  mf->AddLibrary(libname, (shared ? cmStateEnums::SHARED_LIBRARY
+                                  : cmStateEnums::STATIC_LIBRARY),
                  srcs2);
 }
 

+ 2 - 1
Source/cmCTest.cxx

@@ -21,6 +21,7 @@
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmVersion.h"
 #include "cmVersionConfig.h"
@@ -1969,7 +1970,7 @@ bool cmCTest::AddVariableDefinition(const std::string& arg)
 {
   std::string name;
   std::string value;
-  cmState::CacheEntryType type = cmState::UNINITIALIZED;
+  cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED;
 
   if (cmake::ParseCacheEntry(arg, name, value, type)) {
     this->Definitions[name] = value;

+ 17 - 17
Source/cmCacheManager.cxx

@@ -94,13 +94,13 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
         // If the entry is not internal to the cache being loaded
         // or if it is in the list of internal entries to be
         // imported, load it.
-        if (internal || (e.Type != cmState::INTERNAL) ||
+        if (internal || (e.Type != cmStateEnums::INTERNAL) ||
             (includes.find(entryKey) != includes.end())) {
           // If we are loading the cache from another project,
           // make all loaded entries internal so that it is
           // not visible in the gui
           if (!internal) {
-            e.Type = cmState::INTERNAL;
+            e.Type = cmStateEnums::INTERNAL;
             helpString = "DO NOT EDIT, ";
             helpString += entryKey;
             helpString += " loaded from external file.  "
@@ -142,11 +142,11 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
     this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0",
                         "Minor version of cmake used to create the "
                         "current loaded cache",
-                        cmState::INTERNAL);
+                        cmStateEnums::INTERNAL);
     this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0",
                         "Major version of cmake used to create the "
                         "current loaded cache",
-                        cmState::INTERNAL);
+                        cmStateEnums::INTERNAL);
   }
   // check to make sure the cache directory has not
   // been moved
@@ -178,7 +178,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
                                        CacheEntry& e)
 {
   // All property entries are internal.
-  if (e.Type != cmState::INTERNAL) {
+  if (e.Type != cmStateEnums::INTERNAL) {
     return false;
   }
 
@@ -192,7 +192,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
       if (it.IsAtEnd()) {
         // Create an entry and store the property.
         CacheEntry& ne = this->Cache[key];
-        ne.Type = cmState::UNINITIALIZED;
+        ne.Type = cmStateEnums::UNINITIALIZED;
         ne.SetProperty(*p, e.Value.c_str());
       } else {
         // Store this property on its entry.
@@ -244,17 +244,17 @@ bool cmCacheManager::SaveCache(const std::string& path)
   this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp,
                       "Minor version of cmake used to create the "
                       "current loaded cache",
-                      cmState::INTERNAL);
+                      cmStateEnums::INTERNAL);
   sprintf(temp, "%d", cmVersion::GetMajorVersion());
   this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp,
                       "Major version of cmake used to create the "
                       "current loaded cache",
-                      cmState::INTERNAL);
+                      cmStateEnums::INTERNAL);
   sprintf(temp, "%d", cmVersion::GetPatchVersion());
   this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp,
                       "Patch version of cmake used to create the "
                       "current loaded cache",
-                      cmState::INTERNAL);
+                      cmStateEnums::INTERNAL);
 
   // Let us store the current working directory so that if somebody
   // Copies it, he will not be surprised
@@ -268,7 +268,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
   this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
                       "This is the directory where this CMakeCache.txt"
                       " was created",
-                      cmState::INTERNAL);
+                      cmStateEnums::INTERNAL);
 
   /* clang-format off */
   fout << "# This is the CMakeCache file.\n"
@@ -301,14 +301,14 @@ bool cmCacheManager::SaveCache(const std::string& path)
          this->Cache.begin();
        i != this->Cache.end(); ++i) {
     const CacheEntry& ce = (*i).second;
-    cmState::CacheEntryType t = ce.Type;
+    cmStateEnums::CacheEntryType t = ce.Type;
     if (!ce.Initialized) {
       /*
         // This should be added in, but is not for now.
       cmSystemTools::Error("Cache entry \"", (*i).first.c_str(),
                            "\" is uninitialized");
       */
-    } else if (t != cmState::INTERNAL) {
+    } else if (t != cmStateEnums::INTERNAL) {
       // Format is key:type=value
       if (const char* help = ce.GetProperty("HELPSTRING")) {
         cmCacheManager::OutputHelpString(fout, help);
@@ -334,9 +334,9 @@ bool cmCacheManager::SaveCache(const std::string& path)
       continue;
     }
 
-    cmState::CacheEntryType t = i.GetType();
+    cmStateEnums::CacheEntryType t = i.GetType();
     this->WritePropertyEntries(fout, i);
-    if (t == cmState::INTERNAL) {
+    if (t == cmStateEnums::INTERNAL) {
       // Format is key:type=value
       if (const char* help = i.GetProperty("HELPSTRING")) {
         this->OutputHelpString(fout, help);
@@ -465,7 +465,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
   for (std::map<std::string, CacheEntry>::const_iterator i =
          this->Cache.begin();
        i != this->Cache.end(); ++i) {
-    if ((*i).second.Type != cmState::INTERNAL) {
+    if ((*i).second.Type != cmStateEnums::INTERNAL) {
       out << (*i).first << " = " << (*i).second.Value << std::endl;
     }
   }
@@ -477,7 +477,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
 
 void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
                                    const char* helpString,
-                                   cmState::CacheEntryType type)
+                                   cmStateEnums::CacheEntryType type)
 {
   CacheEntry& e = this->Cache[key];
   if (value) {
@@ -488,7 +488,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
   }
   e.Type = type;
   // make sure we only use unix style paths
-  if (type == cmState::FILEPATH || type == cmState::PATH) {
+  if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
     if (e.Value.find(';') != e.Value.npos) {
       std::vector<std::string> paths;
       cmSystemTools::ExpandListArgument(e.Value, paths);

+ 13 - 6
Source/cmCacheManager.h

@@ -34,7 +34,7 @@ private:
   struct CacheEntry
   {
     std::string Value;
-    cmState::CacheEntryType Type;
+    cmStateEnums::CacheEntryType Type;
     cmPropertyMap Properties;
     std::vector<std::string> GetPropertyList() const;
     const char* GetProperty(const std::string&) const;
@@ -44,7 +44,7 @@ private:
     bool Initialized;
     CacheEntry()
       : Value("")
-      , Type(cmState::UNINITIALIZED)
+      , Type(cmStateEnums::UNINITIALIZED)
       , Initialized(false)
     {
     }
@@ -70,8 +70,14 @@ public:
     const char* GetValue() const { return this->GetEntry().Value.c_str(); }
     bool GetValueAsBool() const;
     void SetValue(const char*);
-    cmState::CacheEntryType GetType() const { return this->GetEntry().Type; }
-    void SetType(cmState::CacheEntryType ty) { this->GetEntry().Type = ty; }
+    cmStateEnums::CacheEntryType GetType() const
+    {
+      return this->GetEntry().Type;
+    }
+    void SetType(cmStateEnums::CacheEntryType ty)
+    {
+      this->GetEntry().Type = ty;
+    }
     bool Initialized() { return this->GetEntry().Initialized; }
     cmCacheManager& Container;
     std::map<std::string, CacheEntry>::iterator Position;
@@ -137,7 +143,7 @@ public:
     return this->GetCacheIterator(key.c_str()).GetProperty(propName);
   }
 
-  cmState::CacheEntryType GetCacheEntryType(std::string const& key)
+  cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key)
   {
     return this->GetCacheIterator(key.c_str()).GetType();
   }
@@ -200,7 +206,8 @@ public:
 protected:
   ///! Add an entry into the cache
   void AddCacheEntry(const std::string& key, const char* value,
-                     const char* helpString, cmState::CacheEntryType type);
+                     const char* helpString,
+                     cmStateEnums::CacheEntryType type);
 
   ///! Get a cache entry object for a key
   CacheEntry* GetCacheEntry(const std::string& key);

+ 3 - 2
Source/cmCommonTargetGenerator.cxx

@@ -17,7 +17,8 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
 
 cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
   : GeneratorTarget(gt)
@@ -171,7 +172,7 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories()
           // We can ignore the INTERFACE_LIBRARY items because
           // Target->GetLinkInformation already processed their
           // link interface and they don't have any output themselves.
-          && linkee->GetType() != cmState::INTERFACE_LIBRARY &&
+          && linkee->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
           emitted.insert(linkee).second) {
         cmLocalGenerator* lg = linkee->GetLocalGenerator();
         std::string di = lg->GetCurrentBinaryDirectory();

+ 3 - 3
Source/cmComputeLinkDepends.cxx

@@ -8,7 +8,7 @@
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmake.h"
@@ -262,7 +262,7 @@ cmComputeLinkDepends::Compute()
     LinkEntry const& e = this->EntryList[i];
     cmGeneratorTarget const* t = e.Target;
     // Entries that we know the linker will re-use do not need to be repeated.
-    bool uniquify = t && t->GetType() == cmState::SHARED_LIBRARY;
+    bool uniquify = t && t->GetType() == cmStateEnums::SHARED_LIBRARY;
     if (!uniquify || emmitted.insert(i).second) {
       this->FinalLinkEntries.push_back(e);
     }
@@ -345,7 +345,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
     if (cmLinkInterface const* iface =
           entry.Target->GetLinkInterface(this->Config, this->Target)) {
       const bool isIface =
-        entry.Target->GetType() == cmState::INTERFACE_LIBRARY;
+        entry.Target->GetType() == cmStateEnums::INTERFACE_LIBRARY;
       // This target provides its own link interface information.
       this->AddLinkEntries(depender_index, iface->Libraries);
 

+ 24 - 22
Source/cmComputeLinkInformation.cxx

@@ -12,6 +12,7 @@
 #include "cmOutputConverter.h"
 #include "cmPolicies.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmake.h"
@@ -282,7 +283,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
   // the program that will load it.
   this->LoaderFlag = CM_NULLPTR;
   if (!this->UseImportLibrary &&
-      this->Target->GetType() == cmState::MODULE_LIBRARY) {
+      this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
     std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_";
     loader_flag_var += this->LinkLanguage;
     loader_flag_var += "_FLAG";
@@ -299,10 +300,10 @@ cmComputeLinkInformation::cmComputeLinkInformation(
 
   // Get options needed to specify RPATHs.
   this->RuntimeUseChrpath = false;
-  if (this->Target->GetType() != cmState::STATIC_LIBRARY) {
-    const char* tType =
-      ((this->Target->GetType() == cmState::EXECUTABLE) ? "EXECUTABLE"
-                                                        : "SHARED_LIBRARY");
+  if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) {
+    const char* tType = ((this->Target->GetType() == cmStateEnums::EXECUTABLE)
+                           ? "EXECUTABLE"
+                           : "SHARED_LIBRARY");
     std::string rtVar = "CMAKE_";
     rtVar += tType;
     rtVar += "_RUNTIME_";
@@ -446,10 +447,10 @@ cmComputeLinkInformation::GetSharedLibrariesLinked()
 bool cmComputeLinkInformation::Compute()
 {
   // Skip targets that do not link.
-  if (!(this->Target->GetType() == cmState::EXECUTABLE ||
-        this->Target->GetType() == cmState::SHARED_LIBRARY ||
-        this->Target->GetType() == cmState::MODULE_LIBRARY ||
-        this->Target->GetType() == cmState::STATIC_LIBRARY)) {
+  if (!(this->Target->GetType() == cmStateEnums::EXECUTABLE ||
+        this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+        this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
+        this->Target->GetType() == cmStateEnums::STATIC_LIBRARY)) {
     return false;
   }
 
@@ -498,7 +499,7 @@ bool cmComputeLinkInformation::Compute()
          i != wrongItems.end(); ++i) {
       cmGeneratorTarget const* tgt = *i;
       bool implib = (this->UseImportLibrary &&
-                     (tgt->GetType() == cmState::SHARED_LIBRARY));
+                     (tgt->GetType() == cmStateEnums::SHARED_LIBRARY));
       std::string lib = tgt->GetFullPath(this->Config, implib, true);
       this->OldLinkDirItems.push_back(lib);
     }
@@ -600,20 +601,21 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
       linkItem += exe;
       this->Items.push_back(Item(linkItem, true, tgt));
       this->Depends.push_back(exe);
-    } else if (tgt->GetType() == cmState::INTERFACE_LIBRARY) {
+    } else if (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       // Add the interface library as an item so it can be considered as part
       // of COMPATIBLE_INTERFACE_ enforcement.  The generators will ignore
       // this for the actual link line.
       this->Items.push_back(Item(std::string(), false, tgt));
     } else {
       // Decide whether to use an import library.
-      bool implib = (this->UseImportLibrary &&
-                     (impexe || tgt->GetType() == cmState::SHARED_LIBRARY));
+      bool implib =
+        (this->UseImportLibrary &&
+         (impexe || tgt->GetType() == cmStateEnums::SHARED_LIBRARY));
 
       // Pass the full path to the target file.
       std::string lib = tgt->GetFullPath(config, implib, true);
       if (!this->LinkDependsNoShared ||
-          tgt->GetType() != cmState::SHARED_LIBRARY) {
+          tgt->GetType() != cmStateEnums::SHARED_LIBRARY) {
         this->Depends.push_back(lib);
       }
 
@@ -652,7 +654,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
   if (tgt) {
     // The target will provide a full path.  Make sure it is a shared
     // library.
-    if (tgt->GetType() != cmState::SHARED_LIBRARY) {
+    if (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) {
       return;
     }
   } else {
@@ -725,13 +727,13 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
   const char* shared_link_type_flag = CM_NULLPTR;
   const char* target_type_str = CM_NULLPTR;
   switch (this->Target->GetType()) {
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       target_type_str = "EXE";
       break;
-    case cmState::SHARED_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
       target_type_str = "SHARED_LIBRARY";
       break;
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       target_type_str = "SHARED_MODULE";
       break;
     default:
@@ -964,12 +966,12 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
   // shared and static libraries but static-mode can handle only
   // static libraries.  If a previous user item changed the link type
   // to static we need to make sure it is back to shared.
-  if (target->GetType() != cmState::STATIC_LIBRARY) {
+  if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
     this->SetCurrentLinkType(LinkShared);
   }
 
   // Keep track of shared library targets linked.
-  if (target->GetType() == cmState::SHARED_LIBRARY) {
+  if (target->GetType() == cmStateEnums::SHARED_LIBRARY) {
     this->SharedLibrariesLinked.insert(target);
   }
 
@@ -1590,13 +1592,13 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo(
 
   // Libraries with unknown type must be handled using just the file
   // on disk.
-  if (target->GetType() == cmState::UNKNOWN_LIBRARY) {
+  if (target->GetType() == cmStateEnums::UNKNOWN_LIBRARY) {
     this->AddLibraryRuntimeInfo(fullPath);
     return;
   }
 
   // Skip targets that are not shared libraries (modules cannot be linked).
-  if (target->GetType() != cmState::SHARED_LIBRARY) {
+  if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
     return;
   }
 

+ 11 - 10
Source/cmComputeTargetDepends.cxx

@@ -11,6 +11,7 @@
 #include "cmPolicies.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTargetDepend.h"
@@ -187,7 +188,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
 {
   // Get the depender.
   cmGeneratorTarget const* depender = this->Targets[depender_index];
-  if (depender->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (depender->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return;
   }
 
@@ -212,10 +213,10 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
            oi != objectFiles.end(); ++oi) {
         std::string objLib = (*oi)->GetObjectLibrary();
         if (!objLib.empty() && emitted.insert(objLib).second) {
-          if (depender->GetType() != cmState::EXECUTABLE &&
-              depender->GetType() != cmState::STATIC_LIBRARY &&
-              depender->GetType() != cmState::SHARED_LIBRARY &&
-              depender->GetType() != cmState::MODULE_LIBRARY) {
+          if (depender->GetType() != cmStateEnums::EXECUTABLE &&
+              depender->GetType() != cmStateEnums::STATIC_LIBRARY &&
+              depender->GetType() != cmStateEnums::SHARED_LIBRARY &&
+              depender->GetType() != cmStateEnums::MODULE_LIBRARY) {
             this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
               cmake::FATAL_ERROR,
               "Only executables and non-OBJECT libraries may "
@@ -287,7 +288,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
   // Skip targets that will not really be linked.  This is probably a
   // name conflict between an external library and an executable
   // within the project.
-  if (dependee && dependee->GetType() == cmState::EXECUTABLE &&
+  if (dependee && dependee->GetType() == cmStateEnums::EXECUTABLE &&
       !dependee->IsExecutableWithExports()) {
     dependee = CM_NULLPTR;
   }
@@ -316,7 +317,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
   cmGeneratorTarget const* dependee = dependee_name.Target;
 
   if (!dependee && !linking &&
-      (depender->GetType() != cmState::GLOBAL_TARGET)) {
+      (depender->GetType() != cmStateEnums::GLOBAL_TARGET)) {
     cmake::MessageType messageType = cmake::AUTHOR_WARNING;
     bool issueMessage = false;
     std::ostringstream e;
@@ -351,7 +352,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
   // Skip targets that will not really be linked.  This is probably a
   // name conflict between an external library and an executable
   // within the project.
-  if (linking && dependee && dependee->GetType() == cmState::EXECUTABLE &&
+  if (linking && dependee && dependee->GetType() == cmStateEnums::EXECUTABLE &&
       !dependee->IsExecutableWithExports()) {
     dependee = CM_NULLPTR;
   }
@@ -366,7 +367,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
                                              bool linking)
 {
   if (dependee->IsImported() ||
-      dependee->GetType() == cmState::INTERFACE_LIBRARY) {
+      dependee->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     // Skip IMPORTED and INTERFACE targets but follow their utility
     // dependencies.
     std::set<cmLinkItem> const& utils = dependee->GetUtilityItems();
@@ -452,7 +453,7 @@ bool cmComputeTargetDepends::CheckComponents(
 
     // Make sure the component is all STATIC_LIBRARY targets.
     for (NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) {
-      if (this->Targets[*ni]->GetType() != cmState::STATIC_LIBRARY) {
+      if (this->Targets[*ni]->GetType() != cmStateEnums::STATIC_LIBRARY) {
         this->ComplainAboutBadComponent(ccg, c);
         return false;
       }

+ 1 - 0
Source/cmConditionEvaluator.cxx

@@ -4,6 +4,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmOutputConverter.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
 
 static std::string const keyAND = "AND";

+ 21 - 19
Source/cmCoreTryCompile.cxx

@@ -6,6 +6,7 @@
 #include "cmExportTryCompileFileGenerator.h"
 #include "cmGlobalGenerator.h"
 #include "cmOutputConverter.h"
+#include "cmState.h"
 #include "cmake.h"
 #include <cmsys/Directory.hxx>
 
@@ -43,24 +44,25 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
   // which signature were we called with ?
   this->SrcFileSignature = true;
 
-  cmState::TargetType targetType = cmState::EXECUTABLE;
+  cmStateEnums::TargetType targetType = cmStateEnums::EXECUTABLE;
   const char* tt =
     this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_TARGET_TYPE");
   if (!isTryRun && tt && *tt) {
-    if (strcmp(tt, cmState::GetTargetTypeName(cmState::EXECUTABLE)) == 0) {
-      targetType = cmState::EXECUTABLE;
+    if (strcmp(tt, cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE)) ==
+        0) {
+      targetType = cmStateEnums::EXECUTABLE;
     } else if (strcmp(tt, cmState::GetTargetTypeName(
-                            cmState::STATIC_LIBRARY)) == 0) {
-      targetType = cmState::STATIC_LIBRARY;
+                            cmStateEnums::STATIC_LIBRARY)) == 0) {
+      targetType = cmStateEnums::STATIC_LIBRARY;
     } else {
       this->Makefile->IssueMessage(
         cmake::FATAL_ERROR, std::string("Invalid value '") + tt +
           "' for "
           "CMAKE_TRY_COMPILE_TARGET_TYPE.  Only "
           "'" +
-          cmState::GetTargetTypeName(cmState::EXECUTABLE) + "' and "
-                                                            "'" +
-          cmState::GetTargetTypeName(cmState::STATIC_LIBRARY) +
+          cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE) + "' and "
+                                                                 "'" +
+          cmState::GetTargetTypeName(cmStateEnums::STATIC_LIBRARY) +
           "' "
           "are allowed.");
       return -1;
@@ -122,12 +124,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
       libsToLink += "\"" + cmSystemTools::TrimWhitespace(argv[i]) + "\" ";
       if (cmTarget* tgt = this->Makefile->FindTargetToUse(argv[i])) {
         switch (tgt->GetType()) {
-          case cmState::SHARED_LIBRARY:
-          case cmState::STATIC_LIBRARY:
-          case cmState::INTERFACE_LIBRARY:
-          case cmState::UNKNOWN_LIBRARY:
+          case cmStateEnums::SHARED_LIBRARY:
+          case cmStateEnums::STATIC_LIBRARY:
+          case cmStateEnums::INTERFACE_LIBRARY:
+          case cmStateEnums::UNKNOWN_LIBRARY:
             break;
-          case cmState::EXECUTABLE:
+          case cmStateEnums::EXECUTABLE:
             if (tgt->IsExecutableWithExports()) {
               break;
             }
@@ -481,13 +483,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
               ? "NEW"
               : "OLD");
 
-    if (targetType == cmState::EXECUTABLE) {
+    if (targetType == cmStateEnums::EXECUTABLE) {
       /* Put the executable at a known location (for COPY_FILE).  */
       fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
               this->BinaryDirectory.c_str());
       /* Create the actual executable.  */
       fprintf(fout, "add_executable(%s", targetName.c_str());
-    } else // if (targetType == cmState::STATIC_LIBRARY)
+    } else // if (targetType == cmStateEnums::STATIC_LIBRARY)
     {
       /* Put the static library at a known location (for COPY_FILE).  */
       fprintf(fout, "set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY \"%s\")\n",
@@ -530,7 +532,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
   // set the result var to the return value to indicate success or failure
   this->Makefile->AddCacheDefinition(argv[0], (res == 0 ? "TRUE" : "FALSE"),
                                      "Result of TRY_COMPILE",
-                                     cmState::INTERNAL);
+                                     cmStateEnums::INTERNAL);
 
   if (!outputVariable.empty()) {
     this->Makefile->AddDefinition(outputVariable, output.c_str());
@@ -627,16 +629,16 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
 }
 
 void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
-                                      cmState::TargetType targetType)
+                                      cmStateEnums::TargetType targetType)
 {
   this->FindErrorMessage = "";
   this->OutputFile = "";
   std::string tmpOutputFile = "/";
-  if (targetType == cmState::EXECUTABLE) {
+  if (targetType == cmStateEnums::EXECUTABLE) {
     tmpOutputFile += targetName;
     tmpOutputFile +=
       this->Makefile->GetSafeDefinition("CMAKE_EXECUTABLE_SUFFIX");
-  } else // if (targetType == cmState::STATIC_LIBRARY)
+  } else // if (targetType == cmStateEnums::STATIC_LIBRARY)
   {
     tmpOutputFile +=
       this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX");

+ 1 - 1
Source/cmCoreTryCompile.h

@@ -35,7 +35,7 @@ protected:
   the error message is stored in FindErrorMessage.
    */
   void FindOutputFile(const std::string& targetName,
-                      cmState::TargetType targetType);
+                      cmStateEnums::TargetType targetType);
 
   cmTypeMacro(cmCoreTryCompile, cmCommand);
 

+ 4 - 4
Source/cmCustomCommandGenerator.cxx

@@ -9,7 +9,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmOutputConverter.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cm_auto_ptr.hxx"
 
@@ -42,7 +42,7 @@ bool cmCustomCommandGenerator::UseCrossCompilingEmulator(unsigned int c) const
 {
   std::string const& argv0 = this->CC.GetCommandLines()[c][0];
   cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0);
-  if (target && target->GetType() == cmState::EXECUTABLE) {
+  if (target && target->GetType() == cmStateEnums::EXECUTABLE) {
     return target->GetProperty("CROSSCOMPILING_EMULATOR") != CM_NULLPTR;
   }
   return false;
@@ -52,12 +52,12 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
 {
   std::string const& argv0 = this->CC.GetCommandLines()[c][0];
   cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0);
-  if (target && target->GetType() == cmState::EXECUTABLE &&
+  if (target && target->GetType() == cmStateEnums::EXECUTABLE &&
       (target->IsImported() ||
        !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) {
     return target->GetLocation(this->Config);
   }
-  if (target && target->GetType() == cmState::EXECUTABLE) {
+  if (target && target->GetType() == cmStateEnums::EXECUTABLE) {
     const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR");
     if (emulator) {
       return std::string(emulator);

+ 1 - 0
Source/cmDefinePropertyCommand.cxx

@@ -3,6 +3,7 @@
 #include "cmDefinePropertyCommand.h"
 
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmake.h"
 
 bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,

+ 1 - 0
Source/cmDependsFortran.cxx

@@ -7,6 +7,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmOutputConverter.h"
+#include "cmStateDirectory.h"
 #include "cmSystemTools.h"
 
 #include <assert.h>

+ 12 - 12
Source/cmExportBuildAndroidMKGenerator.cxx

@@ -111,8 +111,8 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
             target->GetLocalGenerator()->FindGeneratorTargetToUse(*i);
           if (gt) {
 
-            if (gt->GetType() == cmState::SHARED_LIBRARY ||
-                gt->GetType() == cmState::MODULE_LIBRARY) {
+            if (gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
+                gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
               sharedLibs += " " + *i;
             } else {
               staticLibs += " " + *i;
@@ -168,7 +168,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
   }
 
   // Tell the NDK build system if prebuilt static libraries use C++.
-  if (target->GetType() == cmState::STATIC_LIBRARY) {
+  if (target->GetType() == cmStateEnums::STATIC_LIBRARY) {
     cmLinkImplementation const* li = target->GetLinkImplementation(config);
     if (std::find(li->Languages.begin(), li->Languages.end(), "CXX") !=
         li->Languages.end()) {
@@ -177,19 +177,19 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
   }
 
   switch (target->GetType()) {
-    case cmState::SHARED_LIBRARY:
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       os << "include $(PREBUILT_SHARED_LIBRARY)\n";
       break;
-    case cmState::STATIC_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
       os << "include $(PREBUILT_STATIC_LIBRARY)\n";
       break;
-    case cmState::EXECUTABLE:
-    case cmState::UTILITY:
-    case cmState::OBJECT_LIBRARY:
-    case cmState::GLOBAL_TARGET:
-    case cmState::INTERFACE_LIBRARY:
-    case cmState::UNKNOWN_LIBRARY:
+    case cmStateEnums::EXECUTABLE:
+    case cmStateEnums::UTILITY:
+    case cmStateEnums::OBJECT_LIBRARY:
+    case cmStateEnums::GLOBAL_TARGET:
+    case cmStateEnums::INTERFACE_LIBRARY:
+    case cmStateEnums::UNKNOWN_LIBRARY:
       break;
   }
   os << "\n";

+ 5 - 5
Source/cmExportBuildFileGenerator.cxx

@@ -9,7 +9,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTargetExport.h"
@@ -57,7 +57,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
           this->LG->GetMakefile()->GetBacktrace());
         return false;
       }
-      if (te->GetType() == cmState::INTERFACE_LIBRARY) {
+      if (te->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
         this->GenerateRequiredCMakeVersion(os, "3.0.0");
       }
     }
@@ -134,12 +134,12 @@ void cmExportBuildFileGenerator::GenerateImportTargetsConfig(
     cmGeneratorTarget* target = *tei;
     ImportPropertyMap properties;
 
-    if (target->GetType() != cmState::INTERFACE_LIBRARY) {
+    if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
       this->SetImportLocationProperty(config, suffix, target, properties);
     }
     if (!properties.empty()) {
       // Get the rest of the target details.
-      if (target->GetType() != cmState::INTERFACE_LIBRARY) {
+      if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
         this->SetImportDetailProperties(config, suffix, target, properties,
                                         missingTargets);
         this->SetImportLinkInterface(config, suffix,
@@ -186,7 +186,7 @@ void cmExportBuildFileGenerator::SetImportLocationProperty(
 
   // Add the import library for windows DLLs.
   if (target->IsDLLPlatform() &&
-      (target->GetType() == cmState::SHARED_LIBRARY ||
+      (target->GetType() == cmStateEnums::SHARED_LIBRARY ||
        target->IsExecutableWithExports()) &&
       mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) {
     std::string prop = "IMPORTED_IMPLIB";

+ 2 - 2
Source/cmExportCommand.cxx

@@ -141,14 +141,14 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args,
       }
 
       if (cmTarget* target = gg->FindTarget(*currentTarget)) {
-        if (target->GetType() == cmState::OBJECT_LIBRARY) {
+        if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
           std::ostringstream e;
           e << "given OBJECT library \"" << *currentTarget
             << "\" which may not be exported.";
           this->SetError(e.str());
           return false;
         }
-        if (target->GetType() == cmState::UTILITY) {
+        if (target->GetType() == cmStateEnums::UTILITY) {
           this->SetError("given custom target \"" + *currentTarget +
                          "\" which may not be exported.");
           return false;

+ 10 - 10
Source/cmExportFileGenerator.cxx

@@ -11,7 +11,7 @@
 #include "cmMakefile.h"
 #include "cmOutputConverter.h"
 #include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTargetExport.h"
@@ -492,7 +492,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
   getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX",
                       ifaceProperties);
 
-  if (gtarget->GetType() != cmState::INTERFACE_LIBRARY) {
+  if (gtarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
     getCompatibleInterfaceProperties(gtarget, ifaceProperties, "");
 
     std::vector<std::string> configNames;
@@ -735,8 +735,8 @@ void cmExportFileGenerator::SetImportDetailProperties(
   cmMakefile* mf = target->Makefile;
 
   // Add the soname for unix shared libraries.
-  if (target->GetType() == cmState::SHARED_LIBRARY ||
-      target->GetType() == cmState::MODULE_LIBRARY) {
+  if (target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+      target->GetType() == cmStateEnums::MODULE_LIBRARY) {
     if (!target->IsDLLPlatform()) {
       std::string prop;
       std::string value;
@@ -912,22 +912,22 @@ void cmExportFileGenerator::GenerateImportTargetCode(
   // Create the imported target.
   os << "# Create imported target " << targetName << "\n";
   switch (target->GetType()) {
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       os << "add_executable(" << targetName << " IMPORTED)\n";
       break;
-    case cmState::STATIC_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
       os << "add_library(" << targetName << " STATIC IMPORTED)\n";
       break;
-    case cmState::SHARED_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
       os << "add_library(" << targetName << " SHARED IMPORTED)\n";
       break;
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       os << "add_library(" << targetName << " MODULE IMPORTED)\n";
       break;
-    case cmState::UNKNOWN_LIBRARY:
+    case cmStateEnums::UNKNOWN_LIBRARY:
       os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n";
       break;
-    case cmState::INTERFACE_LIBRARY:
+    case cmStateEnums::INTERFACE_LIBRARY:
       os << "add_library(" << targetName << " INTERFACE IMPORTED)\n";
       break;
     default: // should never happen

+ 1 - 1
Source/cmExportInstallAndroidMKGenerator.cxx

@@ -38,7 +38,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode(
        tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) {
     // Collect import properties for this target.
     cmTargetExport const* te = *tei;
-    if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     std::string dest;

+ 4 - 4
Source/cmExportInstallFileGenerator.cxx

@@ -14,7 +14,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTargetExport.h"
@@ -81,7 +81,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
     cmGeneratorTarget* gt = (*tei)->Target;
 
     requiresConfigFiles =
-      requiresConfigFiles || gt->GetType() != cmState::INTERFACE_LIBRARY;
+      requiresConfigFiles || gt->GetType() != cmStateEnums::INTERFACE_LIBRARY;
 
     this->GenerateImportTargetCode(os, gt);
 
@@ -120,7 +120,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
         require2_8_12 = true;
       }
     }
-    if (gt->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       require3_0_0 = true;
     }
     if (gt->GetProperty("INTERFACE_SOURCES")) {
@@ -316,7 +316,7 @@ void cmExportInstallFileGenerator::GenerateImportTargetsConfig(
        tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) {
     // Collect import properties for this target.
     cmTargetExport const* te = *tei;
-    if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
 

+ 2 - 2
Source/cmExportLibraryDependenciesCommand.cxx

@@ -79,8 +79,8 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
       cmTarget const& target = l->second;
 
       // Skip non-library targets.
-      if (target.GetType() < cmState::STATIC_LIBRARY ||
-          target.GetType() > cmState::MODULE_LIBRARY) {
+      if (target.GetType() < cmStateEnums::STATIC_LIBRARY ||
+          target.GetType() > cmStateEnums::MODULE_LIBRARY) {
         continue;
       }
 

+ 2 - 2
Source/cmExportTryCompileFileGenerator.cxx

@@ -8,7 +8,7 @@
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cm_auto_ptr.hxx"
@@ -67,7 +67,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
 
   CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
 
-  cmTarget dummyHead("try_compile_dummy_exe", cmState::EXECUTABLE,
+  cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
                      cmTarget::VisibilityNormal, tgt->Target->GetMakefile());
 
   cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());

+ 22 - 22
Source/cmExtraCodeBlocksGenerator.cxx

@@ -9,7 +9,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmXMLWriter.h"
 #include "cmake.h"
@@ -302,7 +302,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
          ti != targets.end(); ti++) {
       std::string targetName = (*ti)->GetName();
       switch ((*ti)->GetType()) {
-        case cmState::GLOBAL_TARGET: {
+        case cmStateEnums::GLOBAL_TARGET: {
           // Only add the global targets from CMAKE_BINARY_DIR,
           // not from the subdirs
           if (strcmp((*lg)->GetCurrentBinaryDirectory(),
@@ -311,7 +311,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
                                compiler.c_str(), makeArgs);
           }
         } break;
-        case cmState::UTILITY:
+        case cmStateEnums::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
           if (((targetName.find("Nightly") == 0) &&
@@ -326,11 +326,11 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
           this->AppendTarget(xml, targetName, CM_NULLPTR, make.c_str(), *lg,
                              compiler.c_str(), makeArgs);
           break;
-        case cmState::EXECUTABLE:
-        case cmState::STATIC_LIBRARY:
-        case cmState::SHARED_LIBRARY:
-        case cmState::MODULE_LIBRARY:
-        case cmState::OBJECT_LIBRARY: {
+        case cmStateEnums::EXECUTABLE:
+        case cmStateEnums::STATIC_LIBRARY:
+        case cmStateEnums::SHARED_LIBRARY:
+        case cmStateEnums::MODULE_LIBRARY:
+        case cmStateEnums::OBJECT_LIBRARY: {
           cmGeneratorTarget* gt = *ti;
           this->AppendTarget(xml, targetName, gt, make.c_str(), *lg,
                              compiler.c_str(), makeArgs);
@@ -364,12 +364,12 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
     for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++) {
       switch ((*ti)->GetType()) {
-        case cmState::EXECUTABLE:
-        case cmState::STATIC_LIBRARY:
-        case cmState::SHARED_LIBRARY:
-        case cmState::MODULE_LIBRARY:
-        case cmState::OBJECT_LIBRARY:
-        case cmState::UTILITY: // can have sources since 2.6.3
+        case cmStateEnums::EXECUTABLE:
+        case cmStateEnums::STATIC_LIBRARY:
+        case cmStateEnums::SHARED_LIBRARY:
+        case cmStateEnums::MODULE_LIBRARY:
+        case cmStateEnums::OBJECT_LIBRARY:
+        case cmStateEnums::UTILITY: // can have sources since 2.6.3
         {
           std::vector<cmSourceFile*> sources;
           cmGeneratorTarget* gt = *ti;
@@ -379,7 +379,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
                si != sources.end(); si++) {
             // don't add source files from UTILITY target which have the
             // GENERATED property set:
-            if (gt->GetType() == cmState::UTILITY &&
+            if (gt->GetType() == cmStateEnums::UTILITY &&
                 (*si)->GetPropertyAsBool("GENERATED")) {
               continue;
             }
@@ -519,7 +519,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
   if (target != CM_NULLPTR) {
     int cbTargetType = this->GetCBTargetType(target);
     std::string workingDir = lg->GetCurrentBinaryDirectory();
-    if (target->GetType() == cmState::EXECUTABLE) {
+    if (target->GetType() == cmStateEnums::EXECUTABLE) {
       // Determine the directory where the executable target is created, and
       // set the working directory to this dir.
       const char* runtimeOutputDir =
@@ -537,7 +537,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
 
     std::string buildType = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
     std::string location;
-    if (target->GetType() == cmState::OBJECT_LIBRARY) {
+    if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
       location =
         this->CreateDummyTargetFile(const_cast<cmLocalGenerator*>(lg), target);
     } else {
@@ -713,17 +713,17 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
 int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target)
 {
   switch (target->GetType()) {
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       if ((target->GetPropertyAsBool("WIN32_EXECUTABLE")) ||
           (target->GetPropertyAsBool("MACOSX_BUNDLE"))) {
         return 0;
       }
       return 1;
-    case cmState::STATIC_LIBRARY:
-    case cmState::OBJECT_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
+    case cmStateEnums::OBJECT_LIBRARY:
       return 2;
-    case cmState::SHARED_LIBRARY:
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       return 3;
     default:
       return 4;

+ 17 - 17
Source/cmExtraCodeLiteGenerator.cxx

@@ -8,7 +8,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmXMLWriter.h"
 #include "cmake.h"
@@ -127,7 +127,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
     for (std::vector<cmGeneratorTarget*>::const_iterator lt =
            (*lg)->GetGeneratorTargets().begin();
          lt != (*lg)->GetGeneratorTargets().end(); lt++) {
-      cmState::TargetType type = (*lt)->GetType();
+      cmStateEnums::TargetType type = (*lt)->GetType();
       std::string outputDir = (*lg)->GetCurrentBinaryDirectory();
       std::string filename = outputDir + "/" + (*lt)->GetName() + ".project";
       retval.push_back((*lt)->GetName());
@@ -136,11 +136,11 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
         this->WorkspacePath.c_str(), filename.c_str());
       std::string visualname = (*lt)->GetName();
       switch (type) {
-        case cmState::SHARED_LIBRARY:
-        case cmState::STATIC_LIBRARY:
-        case cmState::MODULE_LIBRARY:
+        case cmStateEnums::SHARED_LIBRARY:
+        case cmStateEnums::STATIC_LIBRARY:
+        case cmStateEnums::MODULE_LIBRARY:
           visualname = "lib" + visualname;
-        case cmState::EXECUTABLE:
+        case cmStateEnums::EXECUTABLE:
           xml->StartElement("Project");
           xml->Attribute("Name", visualname);
           xml->Attribute("Path", relafilename);
@@ -209,16 +209,16 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
 
   std::string projectType;
   switch (gt->GetType()) {
-    case cmState::EXECUTABLE: {
+    case cmStateEnums::EXECUTABLE: {
       projectType = "Executable";
     } break;
-    case cmState::STATIC_LIBRARY: {
+    case cmStateEnums::STATIC_LIBRARY: {
       projectType = "Static Library";
     } break;
-    case cmState::SHARED_LIBRARY: {
+    case cmStateEnums::SHARED_LIBRARY: {
       projectType = "Dynamic Library";
     } break;
-    case cmState::MODULE_LIBRARY: {
+    case cmStateEnums::MODULE_LIBRARY: {
       projectType = "Dynamic Library";
     } break;
     default: // intended fallthrough
@@ -226,10 +226,10 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
   }
 
   switch (gt->GetType()) {
-    case cmState::EXECUTABLE:
-    case cmState::STATIC_LIBRARY:
-    case cmState::SHARED_LIBRARY:
-    case cmState::MODULE_LIBRARY: {
+    case cmStateEnums::EXECUTABLE:
+    case cmStateEnums::STATIC_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY: {
       std::vector<cmSourceFile*> sources;
       gt->GetSourceFiles(sources,
                          makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
@@ -511,9 +511,9 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
   xml.StartElement("CodeLite_Project");
   std::string visualname = gt->GetName();
   switch (gt->GetType()) {
-    case cmState::STATIC_LIBRARY:
-    case cmState::SHARED_LIBRARY:
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       visualname = "lib" + visualname;
     default: // intended fallthrough
       break;

+ 20 - 16
Source/cmExtraEclipseCDT4Generator.cxx

@@ -12,6 +12,7 @@
 #include "cmSourceFile.h"
 #include "cmSourceGroup.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmXMLWriter.h"
 #include "cmake.h"
@@ -230,7 +231,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
     // in the cache
     valueToUse = envVarValue;
     mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
-                           cacheEntryName.c_str(), cmState::STRING, true);
+                           cacheEntryName.c_str(), cmStateEnums::STRING, true);
     mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
   } else if (!envVarSet && cacheValue != CM_NULLPTR) {
     // It is already in the cache, but not in the env, so use it from the cache
@@ -245,7 +246,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
     if (valueToUse.find(envVarValue) == std::string::npos) {
       valueToUse = envVarValue;
       mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
-                             cacheEntryName.c_str(), cmState::STRING, true);
+                             cacheEntryName.c_str(), cmStateEnums::STRING,
+                             true);
       mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
     }
   }
@@ -482,13 +484,14 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
       std::string linkName2 = linkName;
       linkName2 += "/";
       switch ((*ti)->GetType()) {
-        case cmState::EXECUTABLE:
-        case cmState::STATIC_LIBRARY:
-        case cmState::SHARED_LIBRARY:
-        case cmState::MODULE_LIBRARY:
-        case cmState::OBJECT_LIBRARY: {
+        case cmStateEnums::EXECUTABLE:
+        case cmStateEnums::STATIC_LIBRARY:
+        case cmStateEnums::SHARED_LIBRARY:
+        case cmStateEnums::MODULE_LIBRARY:
+        case cmStateEnums::OBJECT_LIBRARY: {
           const char* prefix =
-            ((*ti)->GetType() == cmState::EXECUTABLE ? "[exe] " : "[lib] ");
+            ((*ti)->GetType() == cmStateEnums::EXECUTABLE ? "[exe] "
+                                                          : "[lib] ");
           linkName2 += prefix;
           linkName2 += (*ti)->GetName();
           this->AppendLinkedResource(xml, linkName2, "virtual:/virtual",
@@ -912,14 +915,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
          ti != targets.end(); ++ti) {
       std::string targetName = (*ti)->GetName();
       switch ((*ti)->GetType()) {
-        case cmState::GLOBAL_TARGET: {
+        case cmStateEnums::GLOBAL_TARGET: {
           // Only add the global targets from CMAKE_BINARY_DIR,
           // not from the subdirs
           if (subdir.empty()) {
             this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": ");
           }
         } break;
-        case cmState::UTILITY:
+        case cmStateEnums::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
           if (((targetName.find("Nightly") == 0) &&
@@ -933,13 +936,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
 
           this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": ");
           break;
-        case cmState::EXECUTABLE:
-        case cmState::STATIC_LIBRARY:
-        case cmState::SHARED_LIBRARY:
-        case cmState::MODULE_LIBRARY:
-        case cmState::OBJECT_LIBRARY: {
+        case cmStateEnums::EXECUTABLE:
+        case cmStateEnums::STATIC_LIBRARY:
+        case cmStateEnums::SHARED_LIBRARY:
+        case cmStateEnums::MODULE_LIBRARY:
+        case cmStateEnums::OBJECT_LIBRARY: {
           const char* prefix =
-            ((*ti)->GetType() == cmState::EXECUTABLE ? "[exe] " : "[lib] ");
+            ((*ti)->GetType() == cmStateEnums::EXECUTABLE ? "[exe] "
+                                                          : "[lib] ");
           this->AppendTarget(xml, targetName, make, makeArgs, subdir, prefix);
           std::string fastTarget = targetName;
           fastTarget += "/fast";

+ 8 - 8
Source/cmExtraKateGenerator.cxx

@@ -8,7 +8,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
 #include <ostream>
@@ -124,7 +124,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
          ti != targets.end(); ++ti) {
       std::string targetName = (*ti)->GetName();
       switch ((*ti)->GetType()) {
-        case cmState::GLOBAL_TARGET: {
+        case cmStateEnums::GLOBAL_TARGET: {
           bool insertTarget = false;
           // Only add the global targets from CMAKE_BINARY_DIR,
           // not from the subdirs
@@ -147,7 +147,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
                                homeOutputDir);
           }
         } break;
-        case cmState::UTILITY:
+        case cmStateEnums::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
           if (((targetName.find("Nightly") == 0) &&
@@ -162,11 +162,11 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
           this->AppendTarget(fout, targetName, make, makeArgs, currentDir,
                              homeOutputDir);
           break;
-        case cmState::EXECUTABLE:
-        case cmState::STATIC_LIBRARY:
-        case cmState::SHARED_LIBRARY:
-        case cmState::MODULE_LIBRARY:
-        case cmState::OBJECT_LIBRARY: {
+        case cmStateEnums::EXECUTABLE:
+        case cmStateEnums::STATIC_LIBRARY:
+        case cmStateEnums::SHARED_LIBRARY:
+        case cmStateEnums::MODULE_LIBRARY:
+        case cmStateEnums::OBJECT_LIBRARY: {
           this->AppendTarget(fout, targetName, make, makeArgs, currentDir,
                              homeOutputDir);
           std::string fastTarget = targetName;

+ 8 - 8
Source/cmExtraSublimeTextGenerator.cxx

@@ -8,7 +8,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
 #include <cmsys/RegularExpression.hxx>
@@ -156,7 +156,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
          ti != targets.end(); ti++) {
       std::string targetName = (*ti)->GetName();
       switch ((*ti)->GetType()) {
-        case cmState::GLOBAL_TARGET: {
+        case cmStateEnums::GLOBAL_TARGET: {
           // Only add the global targets from CMAKE_BINARY_DIR,
           // not from the subdirs
           if (strcmp((*lg)->GetCurrentBinaryDirectory(),
@@ -166,7 +166,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
                                false);
           }
         } break;
-        case cmState::UTILITY:
+        case cmStateEnums::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
           if (((targetName.find("Nightly") == 0) &&
@@ -182,11 +182,11 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
                              makefile, compiler.c_str(), sourceFileFlags,
                              false);
           break;
-        case cmState::EXECUTABLE:
-        case cmState::STATIC_LIBRARY:
-        case cmState::SHARED_LIBRARY:
-        case cmState::MODULE_LIBRARY:
-        case cmState::OBJECT_LIBRARY: {
+        case cmStateEnums::EXECUTABLE:
+        case cmStateEnums::STATIC_LIBRARY:
+        case cmStateEnums::SHARED_LIBRARY:
+        case cmStateEnums::MODULE_LIBRARY:
+        case cmStateEnums::OBJECT_LIBRARY: {
           this->AppendTarget(fout, targetName, *lg, *ti, make.c_str(),
                              makefile, compiler.c_str(), sourceFileFlags,
                              false);

+ 2 - 1
Source/cmFindBase.cxx

@@ -4,6 +4,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 
 cmFindBase::cmFindBase()
 {
@@ -308,7 +309,7 @@ bool cmFindBase::CheckForVariableInCache()
       // this.
       if (cached &&
           state->GetCacheEntryType(this->VariableName) ==
-            cmState::UNINITIALIZED) {
+            cmStateEnums::UNINITIALIZED) {
         this->AlreadyInCacheWithoutMetaInfo = true;
       }
       return true;

+ 4 - 3
Source/cmFindLibraryCommand.cxx

@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmFindLibraryCommand.h"
 
+#include "cmState.h"
 #include <cmsys/Directory.hxx>
 
 cmFindLibraryCommand::cmFindLibraryCommand()
@@ -26,7 +27,7 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
     if (this->AlreadyInCacheWithoutMetaInfo) {
       this->Makefile->AddCacheDefinition(this->VariableName, "",
                                          this->VariableDocumentation.c_str(),
-                                         cmState::FILEPATH);
+                                         cmStateEnums::FILEPATH);
     }
     return true;
   }
@@ -52,13 +53,13 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
     // Save the value in the cache
     this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(),
                                        this->VariableDocumentation.c_str(),
-                                       cmState::FILEPATH);
+                                       cmStateEnums::FILEPATH);
     return true;
   }
   std::string notfound = this->VariableName + "-NOTFOUND";
   this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(),
                                      this->VariableDocumentation.c_str(),
-                                     cmState::FILEPATH);
+                                     cmStateEnums::FILEPATH);
   return true;
 }
 

+ 2 - 1
Source/cmFindPackageCommand.cxx

@@ -3,6 +3,7 @@
 #include "cmFindPackageCommand.h"
 
 #include "cmAlgorithms.h"
+#include "cmState.h"
 #include <cmSystemTools.h>
 #include <cmsys/Directory.hxx>
 #include <cmsys/Encoding.hxx>
@@ -890,7 +891,7 @@ bool cmFindPackageCommand::FindConfig()
   help += ".";
   // We force the value since we do not get here if it was already set.
   this->Makefile->AddCacheDefinition(this->Variable, init.c_str(),
-                                     help.c_str(), cmState::PATH, true);
+                                     help.c_str(), cmStateEnums::PATH, true);
   return found;
 }
 

+ 4 - 3
Source/cmFindPathCommand.cxx

@@ -26,7 +26,8 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn,
     if (this->AlreadyInCacheWithoutMetaInfo) {
       this->Makefile->AddCacheDefinition(
         this->VariableName, "", this->VariableDocumentation.c_str(),
-        (this->IncludeFileInPath ? cmState::FILEPATH : cmState::PATH));
+        (this->IncludeFileInPath ? cmStateEnums::FILEPATH
+                                 : cmStateEnums::PATH));
     }
     return true;
   }
@@ -35,13 +36,13 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn,
   if (!result.empty()) {
     this->Makefile->AddCacheDefinition(
       this->VariableName, result.c_str(), this->VariableDocumentation.c_str(),
-      (this->IncludeFileInPath) ? cmState::FILEPATH : cmState::PATH);
+      (this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH);
     return true;
   }
   this->Makefile->AddCacheDefinition(
     this->VariableName, (this->VariableName + "-NOTFOUND").c_str(),
     this->VariableDocumentation.c_str(),
-    (this->IncludeFileInPath) ? cmState::FILEPATH : cmState::PATH);
+    (this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH);
   return true;
 }
 

+ 3 - 3
Source/cmFindProgramCommand.cxx

@@ -90,7 +90,7 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn,
     if (this->AlreadyInCacheWithoutMetaInfo) {
       this->Makefile->AddCacheDefinition(this->VariableName, "",
                                          this->VariableDocumentation.c_str(),
-                                         cmState::FILEPATH);
+                                         cmStateEnums::FILEPATH);
     }
     return true;
   }
@@ -100,13 +100,13 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn,
     // Save the value in the cache
     this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(),
                                        this->VariableDocumentation.c_str(),
-                                       cmState::FILEPATH);
+                                       cmStateEnums::FILEPATH);
 
     return true;
   }
   this->Makefile->AddCacheDefinition(
     this->VariableName, (this->VariableName + "-NOTFOUND").c_str(),
-    this->VariableDocumentation.c_str(), cmState::FILEPATH);
+    this->VariableDocumentation.c_str(), cmStateEnums::FILEPATH);
   return true;
 }
 

+ 10 - 10
Source/cmGeneratorExpressionNode.cxx

@@ -15,7 +15,7 @@
 #include "cmOutputConverter.h"
 #include "cmPolicies.h"
 #include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cm_auto_ptr.hxx"
@@ -1104,7 +1104,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
 
     if (!prop) {
       if (target->IsImported() ||
-          target->GetType() == cmState::INTERFACE_LIBRARY) {
+          target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
         return linkedTargetsContent;
       }
       if (target->IsLinkInterfaceDependentBoolProperty(propertyName,
@@ -1224,7 +1224,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
       reportError(context, content->GetOriginalExpression(), e.str());
       return std::string();
     }
-    if (gt->GetType() != cmState::OBJECT_LIBRARY) {
+    if (gt->GetType() != cmStateEnums::OBJECT_LIBRARY) {
       std::ostringstream e;
       e << "Objects of target \"" << tgtName
         << "\" referenced but is not an OBJECT library.";
@@ -1506,7 +1506,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
                     "for DLL target platforms.");
       return std::string();
     }
-    if (target->GetType() != cmState::SHARED_LIBRARY) {
+    if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
       ::reportError(context, content->GetOriginalExpression(),
                     "TARGET_SONAME_FILE is allowed only for "
                     "SHARED libraries.");
@@ -1542,11 +1542,11 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
       return std::string();
     }
 
-    cmState::TargetType targetType = target->GetType();
+    cmStateEnums::TargetType targetType = target->GetType();
 
-    if (targetType != cmState::SHARED_LIBRARY &&
-        targetType != cmState::MODULE_LIBRARY &&
-        targetType != cmState::EXECUTABLE) {
+    if (targetType != cmStateEnums::SHARED_LIBRARY &&
+        targetType != cmStateEnums::MODULE_LIBRARY &&
+        targetType != cmStateEnums::EXECUTABLE) {
       ::reportError(context, content->GetOriginalExpression(),
                     "TARGET_PDB_FILE is allowed only for "
                     "targets with linker created artifacts.");
@@ -1646,8 +1646,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
                     "No target \"" + name + "\"");
       return std::string();
     }
-    if (target->GetType() >= cmState::OBJECT_LIBRARY &&
-        target->GetType() != cmState::UNKNOWN_LIBRARY) {
+    if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY &&
+        target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) {
       ::reportError(context, content->GetOriginalExpression(), "Target \"" +
                       name + "\" is not an executable or library.");
       return std::string();

+ 96 - 94
Source/cmGeneratorTarget.cxx

@@ -15,6 +15,7 @@
 #include "cmPropertyMap.h"
 #include "cmSourceFile.h"
 #include "cmSourceFileLocation.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTargetLinkLibraryType.h"
@@ -215,7 +216,7 @@ struct TagVisitor
     , Target(target)
     , GlobalGenerator(target->GetLocalGenerator()->GetGlobalGenerator())
     , Header(CM_HEADER_REGEX)
-    , IsObjLib(target->GetType() == cmState::OBJECT_LIBRARY)
+    , IsObjLib(target->GetType() == cmStateEnums::OBJECT_LIBRARY)
   {
   }
 
@@ -230,7 +231,7 @@ struct TagVisitor
     std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
     if (sf->GetCustomCommand()) {
       DoAccept<IsSameTag<Tag, CustomCommandsTag>::Result>::Do(this->Data, sf);
-    } else if (this->Target->GetType() == cmState::UTILITY) {
+    } else if (this->Target->GetType() == cmStateEnums::UTILITY) {
       DoAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>::Do(this->Data, sf);
     } else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) {
       DoAccept<IsSameTag<Tag, HeaderSourcesTag>::Result>::Do(this->Data, sf);
@@ -368,7 +369,7 @@ cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const
   return this->LocalGenerator;
 }
 
-cmState::TargetType cmGeneratorTarget::GetType() const
+cmStateEnums::TargetType cmGeneratorTarget::GetType() const
 {
   return this->Target->GetType();
 }
@@ -415,7 +416,7 @@ const char* cmGeneratorTarget::GetProperty(const std::string& prop) const
 const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
 {
   switch (this->GetType()) {
-    case cmState::SHARED_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
       if (this->IsDLLPlatform()) {
         if (implib) {
           // A DLL import library is treated as an archive target.
@@ -428,10 +429,10 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
         // library targets.
         return "LIBRARY";
       }
-    case cmState::STATIC_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
       // Static libraries are always treated as archive targets.
       return "ARCHIVE";
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       if (implib) {
         // Module libraries are always treated as library targets.
         return "ARCHIVE";
@@ -439,7 +440,7 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
         // Module import libraries are treated as archive targets.
         return "LIBRARY";
       }
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       if (implib) {
         // Executable import libraries are treated as archive targets.
         return "ARCHIVE";
@@ -845,7 +846,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const
 bool cmGeneratorTarget::IsSystemIncludeDirectory(
   const std::string& dir, const std::string& config) const
 {
-  assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+  assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
   std::string config_upper;
   if (!config.empty()) {
     config_upper = cmSystemTools::UpperCase(config);
@@ -1006,7 +1007,7 @@ static bool processSources(
 void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
                                        const std::string& config) const
 {
-  assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+  assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
 
   if (!this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) {
     // At configure-time, this method can be called as part of getting the
@@ -1151,7 +1152,7 @@ bool cmGeneratorTarget::HasSOName(const std::string& config) const
 {
   // soname is supported only for shared libraries and modules,
   // and then only when the platform supports an soname flag.
-  return ((this->GetType() == cmState::SHARED_LIBRARY) &&
+  return ((this->GetType() == cmStateEnums::SHARED_LIBRARY) &&
           !this->GetPropertyAsBool("NO_SONAME") &&
           this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)));
 }
@@ -1161,9 +1162,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
 {
   // Only executables and shared libraries can have an rpath and may
   // need relinking.
-  if (this->GetType() != cmState::EXECUTABLE &&
-      this->GetType() != cmState::SHARED_LIBRARY &&
-      this->GetType() != cmState::MODULE_LIBRARY) {
+  if (this->GetType() != cmStateEnums::EXECUTABLE &&
+      this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+      this->GetType() != cmStateEnums::MODULE_LIBRARY) {
     return false;
   }
 
@@ -1235,9 +1236,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
 bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
 {
   // Only certain target types have an rpath.
-  if (!(this->GetType() == cmState::SHARED_LIBRARY ||
-        this->GetType() == cmState::MODULE_LIBRARY ||
-        this->GetType() == cmState::EXECUTABLE)) {
+  if (!(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+        this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+        this->GetType() == cmStateEnums::EXECUTABLE)) {
     return false;
   }
 
@@ -1292,7 +1293,7 @@ bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
 bool cmGeneratorTarget::IsImportedSharedLibWithoutSOName(
   const std::string& config) const
 {
-  if (this->IsImported() && this->GetType() == cmState::SHARED_LIBRARY) {
+  if (this->IsImported() && this->GetType() == cmStateEnums::SHARED_LIBRARY) {
     if (cmGeneratorTarget::ImportInfo const* info =
           this->GetImportInfo(config)) {
       return info->NoSOName;
@@ -1308,7 +1309,7 @@ bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir(
   bool macosx_rpath = false;
 
   if (!this->IsImported()) {
-    if (this->GetType() != cmState::SHARED_LIBRARY) {
+    if (this->GetType() != cmStateEnums::SHARED_LIBRARY) {
       return false;
     }
     const char* install_name = this->GetProperty("INSTALL_NAME_DIR");
@@ -1562,17 +1563,17 @@ const cmListFileBacktrace* cmGeneratorTarget::GetUtilityBacktrace(
 
 bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const
 {
-  return this->GetType() == cmState::STATIC_LIBRARY ||
-    this->GetType() == cmState::SHARED_LIBRARY ||
-    this->GetType() == cmState::MODULE_LIBRARY ||
-    this->GetType() == cmState::EXECUTABLE;
+  return this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+    this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+    this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+    this->GetType() == cmStateEnums::EXECUTABLE;
 }
 
 const char* cmGeneratorTarget::GetExportMacro() const
 {
   // Define the symbol for targets that export symbols.
-  if (this->GetType() == cmState::SHARED_LIBRARY ||
-      this->GetType() == cmState::MODULE_LIBRARY ||
+  if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+      this->GetType() == cmStateEnums::MODULE_LIBRARY ||
       this->IsExecutableWithExports()) {
     if (const char* custom_export_name = this->GetProperty("DEFINE_SYMBOL")) {
       this->ExportMacro = custom_export_name;
@@ -1846,7 +1847,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
     return CM_NULLPTR;
   }
 
-  if (this->GetType() > cmState::OBJECT_LIBRARY) {
+  if (this->GetType() > cmStateEnums::OBJECT_LIBRARY) {
     std::string msg = "cmTarget::GetCompileInfo called for ";
     msg += this->GetName();
     msg += " which has type ";
@@ -2023,7 +2024,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target)
   this->CurrentEntry = CM_NULLPTR;
 
   // Queue all the source files already specified for the target.
-  if (target->GetType() != cmState::INTERFACE_LIBRARY) {
+  if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
     std::vector<std::string> configs;
     this->Makefile->GetConfigurations(configs);
     if (configs.empty()) {
@@ -2158,8 +2159,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
     // then make sure it was not a full path to something else, and
     // the fact that the name matched a target was just a coincidence.
     if (cmSystemTools::FileIsFullPath(dep.c_str())) {
-      if (t->GetType() >= cmState::EXECUTABLE &&
-          t->GetType() <= cmState::MODULE_LIBRARY) {
+      if (t->GetType() >= cmStateEnums::EXECUTABLE &&
+          t->GetType() <= cmStateEnums::MODULE_LIBRARY) {
         // This is really only for compatibility so we do not need to
         // worry about configuration names and output names.
         std::string tLocation = t->GetLocationForBuild();
@@ -2199,7 +2200,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc)
     // Check for a target with this name.
     if (cmGeneratorTarget* t =
           this->LocalGenerator->FindGeneratorTargetToUse(command)) {
-      if (t->GetType() == cmState::EXECUTABLE) {
+      if (t->GetType() == cmStateEnums::EXECUTABLE) {
         // The command refers to an executable target built in
         // this project.  Add the target-level dependency to make
         // sure the executable is up to date before this custom
@@ -2273,7 +2274,7 @@ void cmGeneratorTarget::TraceDependencies()
   // would find nothing anyway, but when building CMake itself the "install"
   // target command ends up referencing the "cmake" target but we do not
   // really want the dependency because "install" depend on "all" anyway.
-  if (this->GetType() == cmState::GLOBAL_TARGET) {
+  if (this->GetType() == cmStateEnums::GLOBAL_TARGET) {
     return;
   }
 
@@ -2312,7 +2313,7 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
   std::string const& lang, std::string const& config) const
 {
   switch (this->GetType()) {
-    case cmState::STATIC_LIBRARY: {
+    case cmStateEnums::STATIC_LIBRARY: {
       std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
       if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
         std::string varIPO = var + "_IPO";
@@ -2322,11 +2323,11 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
       }
       return var;
     }
-    case cmState::SHARED_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
       return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY";
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       return "CMAKE_" + lang + "_CREATE_SHARED_MODULE";
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       return "CMAKE_" + lang + "_LINK_EXECUTABLE";
     default:
       break;
@@ -2753,11 +2754,11 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const
   std::string realName;
   std::string impName;
   std::string pdbName;
-  if (this->GetType() == cmState::EXECUTABLE) {
+  if (this->GetType() == cmStateEnums::EXECUTABLE) {
     this->GetExecutableNames(name, realName, impName, pdbName, config);
-  } else if (this->GetType() == cmState::STATIC_LIBRARY ||
-             this->GetType() == cmState::SHARED_LIBRARY ||
-             this->GetType() == cmState::MODULE_LIBRARY) {
+  } else if (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+             this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+             this->GetType() == cmStateEnums::MODULE_LIBRARY) {
     this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
   } else {
     return;
@@ -2843,7 +2844,7 @@ std::string cmGeneratorTarget::NormalGetRealName(
     this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
   }
 
-  if (this->GetType() == cmState::EXECUTABLE) {
+  if (this->GetType() == cmStateEnums::EXECUTABLE) {
     // Compute the real name that will be built.
     std::string name;
     std::string realName;
@@ -2926,8 +2927,8 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName,
   }
 
   // The import library name.
-  if (this->GetType() == cmState::SHARED_LIBRARY ||
-      this->GetType() == cmState::MODULE_LIBRARY) {
+  if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+      this->GetType() == cmStateEnums::MODULE_LIBRARY) {
     impName = this->GetFullNameInternal(config, true);
   } else {
     impName = "";
@@ -2959,7 +2960,7 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
 #else
   // Check for executable version properties.
   const char* version = this->GetProperty("VERSION");
-  if (this->GetType() != cmState::EXECUTABLE ||
+  if (this->GetType() != cmStateEnums::EXECUTABLE ||
       this->Makefile->IsOn("XCODE")) {
     version = CM_NULLPTR;
   }
@@ -3028,10 +3029,10 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
                                             std::string& outSuffix) const
 {
   // Use just the target name for non-main target types.
-  if (this->GetType() != cmState::STATIC_LIBRARY &&
-      this->GetType() != cmState::SHARED_LIBRARY &&
-      this->GetType() != cmState::MODULE_LIBRARY &&
-      this->GetType() != cmState::EXECUTABLE) {
+  if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
+      this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+      this->GetType() != cmStateEnums::MODULE_LIBRARY &&
+      this->GetType() != cmStateEnums::EXECUTABLE) {
     outPrefix = "";
     outBase = this->GetName();
     outSuffix = "";
@@ -3050,9 +3051,9 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
 
   // The implib option is only allowed for shared libraries, module
   // libraries, and executables.
-  if (this->GetType() != cmState::SHARED_LIBRARY &&
-      this->GetType() != cmState::MODULE_LIBRARY &&
-      this->GetType() != cmState::EXECUTABLE) {
+  if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+      this->GetType() != cmStateEnums::MODULE_LIBRARY &&
+      this->GetType() != cmStateEnums::EXECUTABLE) {
     implib = false;
   }
 
@@ -3130,7 +3131,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
 
   // Name shared libraries with their version number on some platforms.
   if (const char* soversion = this->GetProperty("SOVERSION")) {
-    if (this->GetType() == cmState::SHARED_LIBRARY && !implib &&
+    if (this->GetType() == cmStateEnums::SHARED_LIBRARY && !implib &&
         this->Makefile->IsOn("CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION")) {
       outBase += "-";
       outBase += soversion;
@@ -3296,8 +3297,8 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
 bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
   const std::string& p, const std::string& config) const
 {
-  if (this->GetType() == cmState::OBJECT_LIBRARY ||
-      this->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+      this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return false;
   }
   return this->GetCompatibleInterfaces(config).PropsBool.count(p) > 0;
@@ -3306,8 +3307,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
 bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
   const std::string& p, const std::string& config) const
 {
-  if (this->GetType() == cmState::OBJECT_LIBRARY ||
-      this->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+      this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return false;
   }
   return this->GetCompatibleInterfaces(config).PropsString.count(p) > 0;
@@ -3316,8 +3317,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
 bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
   const std::string& p, const std::string& config) const
 {
-  if (this->GetType() == cmState::OBJECT_LIBRARY ||
-      this->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+      this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return false;
   }
   return this->GetCompatibleInterfaces(config).PropsNumberMin.count(p) > 0;
@@ -3326,8 +3327,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
 bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty(
   const std::string& p, const std::string& config) const
 {
-  if (this->GetType() == cmState::OBJECT_LIBRARY ||
-      this->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+      this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return false;
   }
   return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0;
@@ -3921,7 +3922,7 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major,
   minor = 0;
   patch = 0;
 
-  assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+  assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
 
   // Look for a VERSION or SOVERSION property.
   const char* prop = soversion ? "SOVERSION" : "VERSION";
@@ -3993,7 +3994,7 @@ std::string cmGeneratorTarget::CreateFortranModuleDirectory(
 
 std::string cmGeneratorTarget::GetFrameworkVersion() const
 {
-  assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+  assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
 
   if (const char* fversion = this->GetProperty("FRAMEWORK_VERSION")) {
     return fversion;
@@ -4109,7 +4110,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
 
   // Link interfaces are not supported for executables that do not
   // export symbols.
-  if (this->GetType() == cmState::EXECUTABLE &&
+  if (this->GetType() == cmStateEnums::EXECUTABLE &&
       !this->IsExecutableWithExports()) {
     return CM_NULLPTR;
   }
@@ -4143,9 +4144,9 @@ void cmGeneratorTarget::ComputeLinkInterface(
   cmGeneratorTarget const* headTarget) const
 {
   if (iface.ExplicitLibraries) {
-    if (this->GetType() == cmState::SHARED_LIBRARY ||
-        this->GetType() == cmState::STATIC_LIBRARY ||
-        this->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+        this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+        this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       // Shared libraries may have runtime implementation dependencies
       // on other shared libraries that are not in the interface.
       UNORDERED_SET<std::string> emitted;
@@ -4154,7 +4155,7 @@ void cmGeneratorTarget::ComputeLinkInterface(
            li != iface.Libraries.end(); ++li) {
         emitted.insert(*li);
       }
-      if (this->GetType() != cmState::INTERFACE_LIBRARY) {
+      if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
         cmLinkImplementation const* impl = this->GetLinkImplementation(config);
         for (std::vector<cmLinkImplItem>::const_iterator li =
                impl->Libraries.begin();
@@ -4162,7 +4163,7 @@ void cmGeneratorTarget::ComputeLinkInterface(
           if (emitted.insert(*li).second) {
             if (li->Target) {
               // This is a runtime dependency on another shared library.
-              if (li->Target->GetType() == cmState::SHARED_LIBRARY) {
+              if (li->Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
                 iface.SharedDeps.push_back(*li);
               }
             } else {
@@ -4192,7 +4193,7 @@ void cmGeneratorTarget::ComputeLinkInterface(
     }
   }
 
-  if (this->GetType() == cmState::STATIC_LIBRARY) {
+  if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
     // Construct the property name suffix for this configuration.
     std::string suffix = "_";
     if (!config.empty()) {
@@ -4225,7 +4226,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
 
   // Link interfaces are not supported for executables that do not
   // export symbols.
-  if (this->GetType() == cmState::EXECUTABLE &&
+  if (this->GetType() == cmStateEnums::EXECUTABLE &&
       !this->IsExecutableWithExports()) {
     return CM_NULLPTR;
   }
@@ -4372,12 +4373,12 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
     if (out != outdir) {
       conf = "";
     }
-  } else if (this->GetType() == cmState::EXECUTABLE) {
+  } else if (this->GetType() == cmStateEnums::EXECUTABLE) {
     // Lookup the output path for executables.
     out = this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
-  } else if (this->GetType() == cmState::STATIC_LIBRARY ||
-             this->GetType() == cmState::SHARED_LIBRARY ||
-             this->GetType() == cmState::MODULE_LIBRARY) {
+  } else if (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+             this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+             this->GetType() == cmStateEnums::MODULE_LIBRARY) {
     // Lookup the output path for libraries.
     out = this->Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH");
   }
@@ -4486,7 +4487,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
     // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
     linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
     explicitLibraries = this->GetProperty(linkIfaceProp);
-  } else if (this->GetType() == cmState::SHARED_LIBRARY ||
+  } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
              this->IsExecutableWithExports()) {
     // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
     // shared lib or executable.
@@ -4531,8 +4532,9 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
 
   // There is no implicit link interface for executables or modules
   // so if none was explicitly set then there is no link interface.
-  if (!explicitLibraries && (this->GetType() == cmState::EXECUTABLE ||
-                             (this->GetType() == cmState::MODULE_LIBRARY))) {
+  if (!explicitLibraries &&
+      (this->GetType() == cmStateEnums::EXECUTABLE ||
+       (this->GetType() == cmStateEnums::MODULE_LIBRARY))) {
     return;
   }
   iface.Exists = true;
@@ -4661,7 +4663,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
     i = this->ImportInfoMap.insert(entry).first;
   }
 
-  if (this->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return &i->second;
   }
   // If the location is empty then the target is not available for
@@ -4696,7 +4698,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
     std::string linkProp = "INTERFACE_LINK_LIBRARIES";
     const char* propertyLibs = this->GetProperty(linkProp);
 
-    if (this->GetType() != cmState::INTERFACE_LIBRARY) {
+    if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
       if (!propertyLibs) {
         linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
         linkProp += suffix;
@@ -4713,7 +4715,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
       info.Libraries = propertyLibs;
     }
   }
-  if (this->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return;
   }
 
@@ -4734,7 +4736,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
   }
 
   // Get the soname.
-  if (this->GetType() == cmState::SHARED_LIBRARY) {
+  if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
     std::string soProp = "IMPORTED_SONAME";
     soProp += suffix;
     if (const char* config_soname = this->GetProperty(soProp)) {
@@ -4745,7 +4747,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
   }
 
   // Get the "no-soname" mark.
-  if (this->GetType() == cmState::SHARED_LIBRARY) {
+  if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
     std::string soProp = "IMPORTED_NO_SONAME";
     soProp += suffix;
     if (const char* config_no_soname = this->GetProperty(soProp)) {
@@ -4759,7 +4761,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
   // Get the import library.
   if (imp) {
     info.ImportLibrary = imp;
-  } else if (this->GetType() == cmState::SHARED_LIBRARY ||
+  } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
              this->IsExecutableWithExports()) {
     std::string impProp = "IMPORTED_IMPLIB";
     impProp += suffix;
@@ -4795,7 +4797,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
   }
 
   // Get the cyclic repetition count.
-  if (this->GetType() == cmState::STATIC_LIBRARY) {
+  if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
     std::string linkProp = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
     linkProp += suffix;
     if (const char* config_reps = this->GetProperty(linkProp)) {
@@ -5191,12 +5193,12 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
   // Skip targets that will not really be linked.  This is probably a
   // name conflict between an external library and an executable
   // within the project.
-  if (tgt && tgt->GetType() == cmState::EXECUTABLE &&
+  if (tgt && tgt->GetType() == cmStateEnums::EXECUTABLE &&
       !tgt->IsExecutableWithExports()) {
     tgt = CM_NULLPTR;
   }
 
-  if (tgt && tgt->GetType() == cmState::OBJECT_LIBRARY) {
+  if (tgt && tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
     std::ostringstream e;
     e << "Target \"" << this->GetName() << "\" links to "
                                            "OBJECT library \""
@@ -5242,14 +5244,14 @@ bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName,
 
 bool cmGeneratorTarget::IsExecutableWithExports() const
 {
-  return (this->GetType() == cmState::EXECUTABLE &&
+  return (this->GetType() == cmStateEnums::EXECUTABLE &&
           this->GetPropertyAsBool("ENABLE_EXPORTS"));
 }
 
 bool cmGeneratorTarget::HasImportLibrary() const
 {
   return (this->IsDLLPlatform() &&
-          (this->GetType() == cmState::SHARED_LIBRARY ||
+          (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
            this->IsExecutableWithExports()));
 }
 
@@ -5269,24 +5271,24 @@ std::string cmGeneratorTarget::GetSupportDirectory() const
 
 bool cmGeneratorTarget::IsLinkable() const
 {
-  return (this->GetType() == cmState::STATIC_LIBRARY ||
-          this->GetType() == cmState::SHARED_LIBRARY ||
-          this->GetType() == cmState::MODULE_LIBRARY ||
-          this->GetType() == cmState::UNKNOWN_LIBRARY ||
-          this->GetType() == cmState::INTERFACE_LIBRARY ||
+  return (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+          this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+          this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+          this->GetType() == cmStateEnums::UNKNOWN_LIBRARY ||
+          this->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
           this->IsExecutableWithExports());
 }
 
 bool cmGeneratorTarget::IsFrameworkOnApple() const
 {
-  return (this->GetType() == cmState::SHARED_LIBRARY &&
+  return (this->GetType() == cmStateEnums::SHARED_LIBRARY &&
           this->Makefile->IsOn("APPLE") &&
           this->GetPropertyAsBool("FRAMEWORK"));
 }
 
 bool cmGeneratorTarget::IsAppBundleOnApple() const
 {
-  return (this->GetType() == cmState::EXECUTABLE &&
+  return (this->GetType() == cmStateEnums::EXECUTABLE &&
           this->Makefile->IsOn("APPLE") &&
           this->GetPropertyAsBool("MACOSX_BUNDLE"));
 }
@@ -5298,6 +5300,6 @@ bool cmGeneratorTarget::IsXCTestOnApple() const
 
 bool cmGeneratorTarget::IsCFBundleOnApple() const
 {
-  return (this->GetType() == cmState::MODULE_LIBRARY &&
+  return (this->GetType() == cmStateEnums::MODULE_LIBRARY &&
           this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("BUNDLE"));
 }

+ 3 - 3
Source/cmGeneratorTarget.h

@@ -8,7 +8,7 @@
 #include "cmLinkItem.h"
 #include "cmListFileCache.h"
 #include "cmPolicies.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 #include <map>
 #include <set>
@@ -60,7 +60,7 @@ public:
   cmComputeLinkInformation* GetLinkInformation(
     const std::string& config) const;
 
-  cmState::TargetType GetType() const;
+  cmStateEnums::TargetType GetType() const;
   const std::string& GetName() const;
   std::string GetExportName() const;
 
@@ -198,7 +198,7 @@ public:
 
   bool LinkLanguagePropagatesToDependents() const
   {
-    return this->GetType() == cmState::STATIC_LIBRARY;
+    return this->GetType() == cmStateEnums::STATIC_LIBRARY;
   }
 
   /** Get the macro to define when building sources in this target.

+ 1 - 1
Source/cmGetCMakePropertyCommand.cxx

@@ -4,7 +4,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmGlobalGenerator.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmake.h"
 
 // cmGetCMakePropertyCommand

+ 6 - 6
Source/cmGetFilenameComponentCommand.cxx

@@ -88,13 +88,13 @@ bool cmGetFilenameComponentCommand::InitialPass(
 
   if (args.size() >= 4 && args[args.size() - 1] == "CACHE") {
     if (!programArgs.empty() && !storeArgs.empty()) {
-      this->Makefile->AddCacheDefinition(storeArgs, programArgs.c_str(), "",
-                                         args[2] == "PATH" ? cmState::FILEPATH
-                                                           : cmState::STRING);
+      this->Makefile->AddCacheDefinition(
+        storeArgs, programArgs.c_str(), "",
+        args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
     }
-    this->Makefile->AddCacheDefinition(args[0], result.c_str(), "",
-                                       args[2] == "PATH" ? cmState::FILEPATH
-                                                         : cmState::STRING);
+    this->Makefile->AddCacheDefinition(
+      args[0], result.c_str(), "",
+      args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
   } else {
     if (!programArgs.empty() && !storeArgs.empty()) {
       this->Makefile->AddDefinition(storeArgs, programArgs.c_str());

+ 1 - 0
Source/cmGetPropertyCommand.cxx

@@ -6,6 +6,7 @@
 #include "cmPropertyDefinition.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmTargetPropertyComputer.h"
 #include "cmTest.h"
 #include "cmake.h"

+ 4 - 4
Source/cmGhsMultiTargetGenerator.cxx

@@ -130,7 +130,7 @@ void cmGhsMultiTargetGenerator::Generate()
     this->WriteCompilerFlags(config, language);
     this->WriteCompilerDefinitions(config, language);
     this->WriteIncludes(config, language);
-    if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+    if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
       this->WriteTargetLinkLibraries(config, language);
     }
     this->WriteCustomCommands();
@@ -174,7 +174,7 @@ GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag(
   GhsMultiGpj::Types output;
   if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target)) {
     output = GhsMultiGpj::INTERGRITY_APPLICATION;
-  } else if (target->GetType() == cmState::STATIC_LIBRARY) {
+  } else if (target->GetType() == cmStateEnums::STATIC_LIBRARY) {
     output = GhsMultiGpj::LIBRARY;
   } else {
     output = GhsMultiGpj::PROGRAM;
@@ -195,13 +195,13 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string& config,
   std::string outputDir(this->GetOutputDirectory(config));
   std::string outputFilename(this->GetOutputFilename(config));
 
-  if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) {
+  if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
     std::string const static_library_suffix =
       this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
     *this->GetFolderBuildStreams() << "    -o \"" << outputDir
                                    << outputFilename << static_library_suffix
                                    << "\"" << std::endl;
-  } else if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
+  } else if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
     if (notKernel && !this->IsTargetGroup()) {
       *this->GetFolderBuildStreams() << "    -relprog" << std::endl;
     }

+ 1 - 0
Source/cmGlobalBorlandMakefileGenerator.cxx

@@ -4,6 +4,7 @@
 
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
+#include "cmState.h"
 #include "cmake.h"
 
 cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator(cmake* cm)

+ 28 - 27
Source/cmGlobalGenerator.cxx

@@ -29,6 +29,7 @@
 #include "cmQtAutoGeneratorInitializer.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmVersion.h"
 #include "cmake.h"
 
@@ -308,7 +309,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
     makeProgram += "/";
     makeProgram += saveFile;
     mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(),
-                           "make program", cmState::FILEPATH);
+                           "make program", cmStateEnums::FILEPATH);
   }
 }
 
@@ -1062,7 +1063,7 @@ void cmGlobalGenerator::Configure()
   this->FirstTimeProgress = 0.0f;
   this->ClearGeneratorMembers();
 
-  cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
+  cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
 
   snapshot.GetDirectory().SetCurrentSource(
     this->CMakeInstance->GetHomeDirectory());
@@ -1103,7 +1104,7 @@ void cmGlobalGenerator::Configure()
   sprintf(num, "%d", static_cast<int>(this->Makefiles.size()));
   this->GetCMakeInstance()->AddCacheEntry("CMAKE_NUMBER_OF_MAKEFILES", num,
                                           "number of local generators",
-                                          cmState::INTERNAL);
+                                          cmStateEnums::INTERNAL);
 
   // check for link libraries and include directories containing "NOTFOUND"
   // and for infinite loops
@@ -1371,14 +1372,14 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
     filteredTargets.reserve(targets.size());
     for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ++ti) {
-      if ((*ti)->GetType() == cmState::GLOBAL_TARGET) {
+      if ((*ti)->GetType() == cmStateEnums::GLOBAL_TARGET) {
         continue;
       }
-      if ((*ti)->GetType() != cmState::EXECUTABLE &&
-          (*ti)->GetType() != cmState::STATIC_LIBRARY &&
-          (*ti)->GetType() != cmState::SHARED_LIBRARY &&
-          (*ti)->GetType() != cmState::MODULE_LIBRARY &&
-          (*ti)->GetType() != cmState::OBJECT_LIBRARY) {
+      if ((*ti)->GetType() != cmStateEnums::EXECUTABLE &&
+          (*ti)->GetType() != cmStateEnums::STATIC_LIBRARY &&
+          (*ti)->GetType() != cmStateEnums::SHARED_LIBRARY &&
+          (*ti)->GetType() != cmStateEnums::MODULE_LIBRARY &&
+          (*ti)->GetType() != cmStateEnums::OBJECT_LIBRARY) {
         continue;
       }
       if ((!(*ti)->GetPropertyAsBool("AUTOMOC") &&
@@ -1415,13 +1416,13 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
 }
 
 cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
-  cmOutputConverter* outputConverter, cmState::Directory stateDir) const
+  cmOutputConverter* outputConverter, cmStateDirectory stateDir) const
 {
   return new cmLinkLineComputer(outputConverter, stateDir);
 }
 
 cmLinkLineComputer* cmGlobalGenerator::CreateMSVC60LinkLineComputer(
-  cmOutputConverter* outputConverter, cmState::Directory stateDir) const
+  cmOutputConverter* outputConverter, cmStateDirectory stateDir) const
 {
   return new cmMSVC60LinkLineComputer(outputConverter, stateDir);
 }
@@ -1443,13 +1444,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
     cmTargets& targets = mf->GetTargets();
     for (cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) {
       cmTarget* t = &ti->second;
-      if (t->GetType() == cmState::GLOBAL_TARGET) {
+      if (t->GetType() == cmStateEnums::GLOBAL_TARGET) {
         continue;
       }
 
       t->AppendBuildInterfaceIncludes();
 
-      if (t->GetType() == cmState::INTERFACE_LIBRARY) {
+      if (t->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
         continue;
       }
 
@@ -1575,7 +1576,7 @@ void cmGlobalGenerator::CheckTargetProperties()
     this->Makefiles[i]->ConfigureFinalPass();
     cmTargets& targets = this->Makefiles[i]->GetTargets();
     for (cmTargets::iterator l = targets.begin(); l != targets.end(); l++) {
-      if (l->second.GetType() == cmState::INTERFACE_LIBRARY) {
+      if (l->second.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
         continue;
       }
       const cmTarget::LinkLibraryVectorType& libs =
@@ -1886,8 +1887,8 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator* gen,
   this->TryCompileOuterMakefile = mf;
   const char* make =
     gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
-  this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
-                                          "make program", cmState::FILEPATH);
+  this->GetCMakeInstance()->AddCacheEntry(
+    "CMAKE_MAKE_PROGRAM", make, "make program", cmStateEnums::FILEPATH);
   // copy the enabled languages
   this->GetCMakeInstance()->GetState()->SetEnabledLanguages(
     gen->GetCMakeInstance()->GetState()->GetEnabledLanguages());
@@ -1909,10 +1910,10 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen)
   }
 }
 
-bool cmGlobalGenerator::IsExcluded(cmState::Snapshot const& rootSnp,
-                                   cmState::Snapshot const& snp_) const
+bool cmGlobalGenerator::IsExcluded(cmStateSnapshot const& rootSnp,
+                                   cmStateSnapshot const& snp_) const
 {
-  cmState::Snapshot snp = snp_;
+  cmStateSnapshot snp = snp_;
   while (snp.IsValid()) {
     if (snp == rootSnp) {
       // No directory excludes itself.
@@ -1933,8 +1934,8 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
 {
   assert(gen);
 
-  cmState::Snapshot rootSnp = root->GetStateSnapshot();
-  cmState::Snapshot snp = gen->GetStateSnapshot();
+  cmStateSnapshot rootSnp = root->GetStateSnapshot();
+  cmStateSnapshot snp = gen->GetStateSnapshot();
 
   return this->IsExcluded(rootSnp, snp);
 }
@@ -1942,7 +1943,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
 bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
                                    cmGeneratorTarget* target) const
 {
-  if (target->GetType() == cmState::INTERFACE_LIBRARY ||
+  if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
       target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
     // This target is excluded from its directory.
     return true;
@@ -1974,7 +1975,7 @@ void cmGlobalGenerator::FillProjectMap()
   unsigned int i;
   for (i = 0; i < this->LocalGenerators.size(); ++i) {
     // for each local generator add all projects
-    cmState::Snapshot snp = this->LocalGenerators[i]->GetStateSnapshot();
+    cmStateSnapshot snp = this->LocalGenerators[i]->GetStateSnapshot();
     std::string name;
     do {
       std::string snpProjName = snp.GetProjectName();
@@ -2398,8 +2399,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
                                                cmMakefile* mf)
 {
   // Package
-  cmTarget target(gti.Name, cmState::GLOBAL_TARGET, cmTarget::VisibilityNormal,
-                  mf);
+  cmTarget target(gti.Name, cmStateEnums::GLOBAL_TARGET,
+                  cmTarget::VisibilityNormal, mf);
   target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
 
   std::vector<std::string> no_outputs;
@@ -2544,7 +2545,7 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
 
 bool cmGlobalGenerator::IsRootOnlyTarget(cmGeneratorTarget* target) const
 {
-  return (target->GetType() == cmState::GLOBAL_TARGET ||
+  return (target->GetType() == cmStateEnums::GLOBAL_TARGET ||
           target->GetName() == this->GetAllTargetName());
 }
 
@@ -2729,7 +2730,7 @@ void cmGlobalGenerator::WriteSummary()
       this->LocalGenerators[i]->GetGeneratorTargets();
     for (std::vector<cmGeneratorTarget*>::iterator it = tgts.begin();
          it != tgts.end(); ++it) {
-      if ((*it)->GetType() == cmState::INTERFACE_LIBRARY) {
+      if ((*it)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
         continue;
       }
       this->WriteSummary(*it);

+ 6 - 5
Source/cmGlobalGenerator.h

@@ -6,7 +6,8 @@
 #include <cmConfigure.h>
 
 #include "cmExportSetMap.h"
-#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTargetDepend.h"
@@ -108,10 +109,10 @@ public:
   virtual void Generate();
 
   virtual cmLinkLineComputer* CreateLinkLineComputer(
-    cmOutputConverter* outputConverter, cmState::Directory stateDir) const;
+    cmOutputConverter* outputConverter, cmStateDirectory stateDir) const;
 
   cmLinkLineComputer* CreateMSVC60LinkLineComputer(
-    cmOutputConverter* outputConverter, cmState::Directory stateDir) const;
+    cmOutputConverter* outputConverter, cmStateDirectory stateDir) const;
 
   /**
    * Set/Get and Clear the enabled languages.
@@ -410,8 +411,8 @@ protected:
   // has been populated.
   void FillProjectMap();
   void CheckTargetProperties();
-  bool IsExcluded(cmState::Snapshot const& root,
-                  cmState::Snapshot const& snp) const;
+  bool IsExcluded(cmStateSnapshot const& root,
+                  cmStateSnapshot const& snp) const;
   bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
   bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
   virtual void InitializeProgressMarks() {}

+ 1 - 0
Source/cmGlobalJOMMakefileGenerator.cxx

@@ -4,6 +4,7 @@
 
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
+#include "cmState.h"
 
 cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator(cmake* cm)
   : cmGlobalUnixMakefileGenerator3(cm)

+ 2 - 2
Source/cmGlobalKdevelopGenerator.cxx

@@ -8,7 +8,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmXMLWriter.h"
@@ -74,7 +74,7 @@ void cmGlobalKdevelopGenerator::Generate()
       for (std::vector<cmGeneratorTarget*>::const_iterator ti =
              targets.begin();
            ti != targets.end(); ti++) {
-        if ((*ti)->GetType() == cmState::EXECUTABLE) {
+        if ((*ti)->GetType() == cmStateEnums::EXECUTABLE) {
           executable = (*ti)->GetLocation("");
           break;
         }

+ 1 - 0
Source/cmGlobalMSYSMakefileGenerator.cxx

@@ -4,6 +4,7 @@
 
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
+#include "cmState.h"
 #include "cmake.h"
 #include <cmsys/FStream.hxx>
 

+ 1 - 0
Source/cmGlobalMinGWMakefileGenerator.cxx

@@ -4,6 +4,7 @@
 
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
+#include "cmState.h"
 
 cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
   : cmGlobalUnixMakefileGenerator3(cm)

+ 1 - 0
Source/cmGlobalNMakeMakefileGenerator.cxx

@@ -4,6 +4,7 @@
 
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
+#include "cmState.h"
 
 cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
   : cmGlobalUnixMakefileGenerator3(cm)

+ 22 - 21
Source/cmGlobalNinjaGenerator.cxx

@@ -13,7 +13,7 @@
 #include "cmMakefile.h"
 #include "cmNinjaLinkLineComputer.h"
 #include "cmOutputConverter.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTargetDepend.h"
@@ -66,7 +66,7 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
 }
 
 cmLinkLineComputer* cmGlobalNinjaGenerator::CreateLinkLineComputer(
-  cmOutputConverter* outputConverter, cmState::Directory /* stateDir */) const
+  cmOutputConverter* outputConverter, cmStateDirectory /* stateDir */) const
 {
   return new cmNinjaLinkLineComputer(
     outputConverter,
@@ -956,17 +956,17 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
   bool realname = target->IsFrameworkOnApple();
 
   switch (target->GetType()) {
-    case cmState::EXECUTABLE:
-    case cmState::SHARED_LIBRARY:
-    case cmState::STATIC_LIBRARY:
-    case cmState::MODULE_LIBRARY: {
+    case cmStateEnums::EXECUTABLE:
+    case cmStateEnums::SHARED_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY: {
       outputs.push_back(this->ConvertToNinjaPath(
         target->GetFullPath(configName, false, realname)));
       break;
     }
-    case cmState::OBJECT_LIBRARY:
-    case cmState::GLOBAL_TARGET:
-    case cmState::UTILITY: {
+    case cmStateEnums::OBJECT_LIBRARY:
+    case cmStateEnums::GLOBAL_TARGET:
+    case cmStateEnums::UTILITY: {
       std::string path =
         target->GetLocalGenerator()->GetCurrentBinaryDirectory() +
         std::string("/") + target->GetName();
@@ -982,7 +982,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
 void cmGlobalNinjaGenerator::AppendTargetDepends(
   cmGeneratorTarget const* target, cmNinjaDeps& outputs)
 {
-  if (target->GetType() == cmState::GLOBAL_TARGET) {
+  if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
     // These depend only on other CMake-provided targets, e.g. "all".
     std::set<std::string> const& utils = target->GetUtilities();
     for (std::set<std::string>::const_iterator i = utils.begin();
@@ -997,7 +997,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
     cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
     for (cmTargetDependSet::const_iterator i = targetDeps.begin();
          i != targetDeps.end(); ++i) {
-      if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) {
+      if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
         continue;
       }
       this->AppendTargetOutputs(*i, outs);
@@ -1034,7 +1034,7 @@ void cmGlobalNinjaGenerator::ComputeTargetDependsClosure(
   cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
   for (cmTargetDependSet::const_iterator i = targetDeps.begin();
        i != targetDeps.end(); ++i) {
-    if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) {
+    if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     if (depends.insert(*i).second) {
@@ -1102,11 +1102,13 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
            lg->GetGeneratorTargets().begin();
          ti != lg->GetGeneratorTargets().end(); ++ti) {
       cmGeneratorTarget const* gt = *ti;
-      cmState::TargetType const type = gt->GetType();
-      if ((type == cmState::EXECUTABLE || type == cmState::STATIC_LIBRARY ||
-           type == cmState::SHARED_LIBRARY ||
-           type == cmState::MODULE_LIBRARY ||
-           type == cmState::OBJECT_LIBRARY || type == cmState::UTILITY) &&
+      cmStateEnums::TargetType const type = gt->GetType();
+      if ((type == cmStateEnums::EXECUTABLE ||
+           type == cmStateEnums::STATIC_LIBRARY ||
+           type == cmStateEnums::SHARED_LIBRARY ||
+           type == cmStateEnums::MODULE_LIBRARY ||
+           type == cmStateEnums::OBJECT_LIBRARY ||
+           type == cmStateEnums::UTILITY) &&
           !gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
         targetsPerFolder[currentSourceFolder].push_back(gt->GetName());
       }
@@ -1114,9 +1116,9 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
 
     // The directory-level rule should depend on the directory-level
     // rules of the subdirectories.
-    std::vector<cmState::Snapshot> const& children =
+    std::vector<cmStateSnapshot> const& children =
       lg->GetStateSnapshot().GetChildren();
-    for (std::vector<cmState::Snapshot>::const_iterator stateIt =
+    for (std::vector<cmStateSnapshot>::const_iterator stateIt =
            children.begin();
          stateIt != children.end(); ++stateIt) {
       targetsPerFolder[currentSourceFolder].push_back(
@@ -1665,8 +1667,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
 {
   // Setup path conversions.
   {
-    cmState::Snapshot snapshot =
-      this->GetCMakeInstance()->GetCurrentSnapshot();
+    cmStateSnapshot snapshot = this->GetCMakeInstance()->GetCurrentSnapshot();
     snapshot.GetDirectory().SetCurrentSource(dir_cur_src);
     snapshot.GetDirectory().SetCurrentBinary(dir_cur_bld);
     snapshot.GetDirectory().SetRelativePathTopSource(dir_top_src.c_str());

+ 1 - 1
Source/cmGlobalNinjaGenerator.h

@@ -72,7 +72,7 @@ public:
 
   cmLinkLineComputer* CreateLinkLineComputer(
     cmOutputConverter* outputConverter,
-    cmState::Directory stateDir) const CM_OVERRIDE;
+    cmStateDirectory stateDir) const CM_OVERRIDE;
 
   /**
    * Write the given @a comment to the output stream @a os. It

+ 43 - 37
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -12,6 +12,8 @@
 #include "cmMakefile.h"
 #include "cmMakefileTargetGenerator.h"
 #include "cmOutputConverter.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTargetDepend.h"
@@ -93,7 +95,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
     if (!editCacheCommand.empty()) {
       cm->AddCacheEntry("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
                         "Path to cache edit program executable.",
-                        cmState::INTERNAL);
+                        cmStateEnums::INTERNAL);
     }
   }
   const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND");
@@ -382,12 +384,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules(
     std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
     for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
          l != tgts.end(); l++) {
-      if (((*l)->GetType() == cmState::EXECUTABLE) ||
-          ((*l)->GetType() == cmState::STATIC_LIBRARY) ||
-          ((*l)->GetType() == cmState::SHARED_LIBRARY) ||
-          ((*l)->GetType() == cmState::MODULE_LIBRARY) ||
-          ((*l)->GetType() == cmState::OBJECT_LIBRARY) ||
-          ((*l)->GetType() == cmState::UTILITY)) {
+      if (((*l)->GetType() == cmStateEnums::EXECUTABLE) ||
+          ((*l)->GetType() == cmStateEnums::STATIC_LIBRARY) ||
+          ((*l)->GetType() == cmStateEnums::SHARED_LIBRARY) ||
+          ((*l)->GetType() == cmStateEnums::MODULE_LIBRARY) ||
+          ((*l)->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
+          ((*l)->GetType() == cmStateEnums::UTILITY)) {
         cmGeneratorTarget* gt = *l;
         std::string tname = lg->GetRelativeTargetDirectory(gt);
         tname += "/DependInfo.cmake";
@@ -416,10 +418,12 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
        l != targets.end(); ++l) {
     cmGeneratorTarget* gtarget = *l;
     int type = gtarget->GetType();
-    if ((type == cmState::EXECUTABLE) || (type == cmState::STATIC_LIBRARY) ||
-        (type == cmState::SHARED_LIBRARY) ||
-        (type == cmState::MODULE_LIBRARY) ||
-        (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY)) {
+    if ((type == cmStateEnums::EXECUTABLE) ||
+        (type == cmStateEnums::STATIC_LIBRARY) ||
+        (type == cmStateEnums::SHARED_LIBRARY) ||
+        (type == cmStateEnums::MODULE_LIBRARY) ||
+        (type == cmStateEnums::OBJECT_LIBRARY) ||
+        (type == cmStateEnums::UTILITY)) {
       // Add this to the list of depends rules in this directory.
       if ((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
           (!check_relink ||
@@ -434,9 +438,8 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
 
   // The directory-level rule should depend on the directory-level
   // rules of the subdirectories.
-  std::vector<cmState::Snapshot> children =
-    lg->GetStateSnapshot().GetChildren();
-  for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
+  std::vector<cmStateSnapshot> children = lg->GetStateSnapshot().GetChildren();
+  for (std::vector<cmStateSnapshot>::const_iterator ci = children.begin();
        ci != children.end(); ++ci) {
     std::string subdir = ci->GetDirectory().GetCurrentBinary();
     subdir += "/";
@@ -505,7 +508,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
     if (!this->Makefiles.empty()) {
       mf = this->Makefiles[0];
     } else {
-      cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
+      cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
       snapshot.GetDirectory().SetCurrentSource(
         this->CMakeInstance->GetHomeDirectory());
       snapshot.GetDirectory().SetCurrentBinary(
@@ -554,11 +557,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules(
       if (!name.empty() && emitted.insert(name).second &&
           // Handle user targets here.  Global targets are handled in
           // the local generator on a per-directory basis.
-          ((type == cmState::EXECUTABLE) ||
-           (type == cmState::STATIC_LIBRARY) ||
-           (type == cmState::SHARED_LIBRARY) ||
-           (type == cmState::MODULE_LIBRARY) ||
-           (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY))) {
+          ((type == cmStateEnums::EXECUTABLE) ||
+           (type == cmStateEnums::STATIC_LIBRARY) ||
+           (type == cmStateEnums::SHARED_LIBRARY) ||
+           (type == cmStateEnums::MODULE_LIBRARY) ||
+           (type == cmStateEnums::OBJECT_LIBRARY) ||
+           (type == cmStateEnums::UTILITY))) {
         // Add a rule to build the target by name.
         lg->WriteDivider(ruleFileStream);
         ruleFileStream << "# Target rules for targets named " << name
@@ -630,11 +634,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
     cmGeneratorTarget* gtarget = *t;
     int type = gtarget->GetType();
     std::string name = gtarget->GetName();
-    if (!name.empty() &&
-        ((type == cmState::EXECUTABLE) || (type == cmState::STATIC_LIBRARY) ||
-         (type == cmState::SHARED_LIBRARY) ||
-         (type == cmState::MODULE_LIBRARY) ||
-         (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY))) {
+    if (!name.empty() && ((type == cmStateEnums::EXECUTABLE) ||
+                          (type == cmStateEnums::STATIC_LIBRARY) ||
+                          (type == cmStateEnums::SHARED_LIBRARY) ||
+                          (type == cmStateEnums::MODULE_LIBRARY) ||
+                          (type == cmStateEnums::OBJECT_LIBRARY) ||
+                          (type == cmStateEnums::UTILITY))) {
       std::string makefileName;
       // Add a rule to build the target by name.
       localName = lg->GetRelativeTargetDirectory(gtarget);
@@ -808,13 +813,13 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
 
       cmLocalGenerator* tlg = gt->GetLocalGenerator();
 
-      if (gt->GetType() == cmState::INTERFACE_LIBRARY ||
+      if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
           gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
         continue;
       }
 
-      cmState::Snapshot csnp = lg->GetStateSnapshot();
-      cmState::Snapshot tsnp = tlg->GetStateSnapshot();
+      cmStateSnapshot csnp = lg->GetStateSnapshot();
+      cmStateSnapshot tsnp = tlg->GetStateSnapshot();
 
       // Consider the directory containing the target and all its
       // parents until something excludes the target.
@@ -847,7 +852,7 @@ size_t cmGlobalUnixMakefileGenerator3::CountProgressMarksInTarget(
     TargetDependSet const& depends = this->GetTargetDirectDepends(target);
     for (TargetDependSet::const_iterator di = depends.begin();
          di != depends.end(); ++di) {
-      if ((*di)->GetType() == cmState::INTERFACE_LIBRARY) {
+      if ((*di)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
         continue;
       }
       count += this->CountProgressMarksInTarget(*di, emitted);
@@ -908,7 +913,7 @@ void cmGlobalUnixMakefileGenerator3::AppendGlobalTargetDepends(
        i != depends_set.end(); ++i) {
     // Create the target-level dependency.
     cmGeneratorTarget const* dep = *i;
-    if (dep->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (dep->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     cmLocalUnixMakefileGenerator3* lg3 =
@@ -950,13 +955,14 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
       for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
            t != targets.end(); ++t) {
         cmGeneratorTarget* target = *t;
-        cmState::TargetType type = target->GetType();
-        if ((type == cmState::EXECUTABLE) ||
-            (type == cmState::STATIC_LIBRARY) ||
-            (type == cmState::SHARED_LIBRARY) ||
-            (type == cmState::MODULE_LIBRARY) ||
-            (type == cmState::OBJECT_LIBRARY) ||
-            (type == cmState::GLOBAL_TARGET) || (type == cmState::UTILITY)) {
+        cmStateEnums::TargetType type = target->GetType();
+        if ((type == cmStateEnums::EXECUTABLE) ||
+            (type == cmStateEnums::STATIC_LIBRARY) ||
+            (type == cmStateEnums::SHARED_LIBRARY) ||
+            (type == cmStateEnums::MODULE_LIBRARY) ||
+            (type == cmStateEnums::OBJECT_LIBRARY) ||
+            (type == cmStateEnums::GLOBAL_TARGET) ||
+            (type == cmStateEnums::UTILITY)) {
           std::string name = target->GetName();
           if (emittedTargets.insert(name).second) {
             path = "... ";

+ 3 - 3
Source/cmGlobalUnixMakefileGenerator3.h

@@ -8,7 +8,7 @@
 #include "cmGeneratorTarget.h"
 #include "cmGlobalCommonGenerator.h"
 #include "cmGlobalGeneratorFactory.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 #include <iosfwd>
 #include <map>
@@ -248,8 +248,8 @@ private:
   const char* GetBuildIgnoreErrorsFlag() const CM_OVERRIDE { return "-i"; }
   std::string GetEditCacheCommand() const CM_OVERRIDE;
 
-  std::map<cmState::Snapshot, std::set<cmGeneratorTarget const*>,
-           cmState::Snapshot::StrictWeakOrder>
+  std::map<cmStateSnapshot, std::set<cmGeneratorTarget const*>,
+           cmStateSnapshot::StrictWeakOrder>
     DirectoryTargetsMap;
   void InitializeProgressMarks() CM_OVERRIDE;
 };

+ 3 - 2
Source/cmGlobalVisualStudio11Generator.cxx

@@ -230,9 +230,10 @@ cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs()
 }
 
 bool cmGlobalVisualStudio11Generator::NeedsDeploy(
-  cmState::TargetType type) const
+  cmStateEnums::TargetType type) const
 {
-  if ((type == cmState::EXECUTABLE || type == cmState::SHARED_LIBRARY) &&
+  if ((type == cmStateEnums::EXECUTABLE ||
+       type == cmStateEnums::SHARED_LIBRARY) &&
       (this->SystemIsWindowsPhone || this->SystemIsWindowsStore)) {
     return true;
   }

+ 1 - 1
Source/cmGlobalVisualStudio11Generator.h

@@ -37,7 +37,7 @@ protected:
   static std::set<std::string> GetInstalledWindowsCESDKs();
 
   /** Return true if the configuration needs to be deployed */
-  virtual bool NeedsDeploy(cmState::TargetType type) const;
+  virtual bool NeedsDeploy(cmStateEnums::TargetType type) const;
 
 private:
   class Factory;

+ 1 - 1
Source/cmGlobalVisualStudio71Generator.cxx

@@ -246,7 +246,7 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject(
 // Write a dsp file into the SLN file, Note, that dependencies from
 // executables to the libraries it uses are also done here
 void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
-  std::ostream& fout, const std::string& name, cmState::TargetType,
+  std::ostream& fout, const std::string& name, cmStateEnums::TargetType,
   std::vector<std::string> const& configs,
   const std::set<std::string>& configsPartOfDefaultBuild,
   std::string const& platformMapping)

+ 1 - 1
Source/cmGlobalVisualStudio71Generator.h

@@ -56,7 +56,7 @@ protected:
                                    const char* path,
                                    cmGeneratorTarget const* t);
   virtual void WriteProjectConfigurations(
-    std::ostream& fout, const std::string& name, cmState::TargetType type,
+    std::ostream& fout, const std::string& name, cmStateEnums::TargetType type,
     std::vector<std::string> const& configs,
     const std::set<std::string>& configsPartOfDefaultBuild,
     const std::string& platformMapping = "");

+ 8 - 7
Source/cmGlobalVisualStudio7Generator.cxx

@@ -8,6 +8,7 @@
 #include "cmGeneratorTarget.h"
 #include "cmLocalVisualStudio7Generator.h"
 #include "cmMakefile.h"
+#include "cmState.h"
 #include "cmUuid.h"
 #include "cmake.h"
 #include <cmsys/Encoding.hxx>
@@ -101,7 +102,7 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(
       "Semicolon separated list of supported configuration types, "
       "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
       "anything else will be ignored.",
-      cmState::STRING);
+      cmStateEnums::STRING);
   }
 
   // Create list of configurations requested by user's cache, if any.
@@ -118,7 +119,7 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(
   if (cmSystemTools::GetEnv("CMAKE_MSVCIDE_RUN_PATH", extraPath)) {
     mf->AddCacheDefinition("CMAKE_MSVCIDE_RUN_PATH", extraPath.c_str(),
                            "Saved environment variable CMAKE_MSVCIDE_RUN_PATH",
-                           cmState::STATIC);
+                           cmStateEnums::STATIC);
   }
 }
 
@@ -345,7 +346,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
   for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin();
        tt != projectTargets.end(); ++tt) {
     cmGeneratorTarget const* target = *tt;
-    if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
@@ -377,7 +378,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
   for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin();
        tt != projectTargets.end(); ++tt) {
     cmGeneratorTarget const* target = *tt;
-    if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     bool written = false;
@@ -446,7 +447,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
   for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin();
        tt != projectTargets.end(); ++tt) {
     cmGeneratorTarget const* target = *tt;
-    if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     const char* vcprojName = target->GetProperty("GENERATOR_FILE_NAME");
@@ -676,7 +677,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
   // if it is a utilitiy target then only make it part of the
   // default build if another target depends on it
   int type = target->GetType();
-  if (type == cmState::GLOBAL_TARGET) {
+  if (type == cmStateEnums::GLOBAL_TARGET) {
     // check if INSTALL target is part of default build
     if (target->GetName() == "INSTALL") {
       // inspect CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD properties
@@ -696,7 +697,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
     }
     return activeConfigs;
   }
-  if (type == cmState::UTILITY &&
+  if (type == cmStateEnums::UTILITY &&
       !this->IsDependedOn(projectTargets, target)) {
     return activeConfigs;
   }

+ 1 - 1
Source/cmGlobalVisualStudio7Generator.h

@@ -120,7 +120,7 @@ protected:
                                    const char* path,
                                    cmGeneratorTarget const* t) = 0;
   virtual void WriteProjectConfigurations(
-    std::ostream& fout, const std::string& name, cmState::TargetType type,
+    std::ostream& fout, const std::string& name, cmStateEnums::TargetType type,
     std::vector<std::string> const& configs,
     const std::set<std::string>& configsPartOfDefaultBuild,
     const std::string& platformMapping = "") = 0;

+ 5 - 5
Source/cmGlobalVisualStudio8Generator.cxx

@@ -347,7 +347,7 @@ void cmGlobalVisualStudio8Generator::WriteSolutionConfigurations(
 }
 
 void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
-  std::ostream& fout, const std::string& name, cmState::TargetType type,
+  std::ostream& fout, const std::string& name, cmStateEnums::TargetType type,
   std::vector<std::string> const& configs,
   const std::set<std::string>& configsPartOfDefaultBuild,
   std::string const& platformMapping)
@@ -380,10 +380,10 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
 }
 
 bool cmGlobalVisualStudio8Generator::NeedsDeploy(
-  cmState::TargetType type) const
+  cmStateEnums::TargetType type) const
 {
   bool needsDeploy =
-    (type == cmState::EXECUTABLE || type == cmState::SHARED_LIBRARY);
+    (type == cmStateEnums::EXECUTABLE || type == cmStateEnums::SHARED_LIBRARY);
   return this->TargetsWindowsCE() && needsDeploy;
 }
 
@@ -402,7 +402,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends(
   OrderedTargetDependSet depends(unordered, std::string());
   for (OrderedTargetDependSet::const_iterator i = depends.begin();
        i != depends.end(); ++i) {
-    if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) {
+    if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     std::string guid = this->GetGUID((*i)->GetName().c_str());
@@ -419,7 +419,7 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
        ui != target->GetUtilities().end(); ++ui) {
     if (cmGeneratorTarget* depTarget =
           target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str())) {
-      if (depTarget->GetType() != cmState::INTERFACE_LIBRARY &&
+      if (depTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
           depTarget->GetProperty("EXTERNAL_MSPROJECT")) {
         // This utility dependency names an external .vcproj target.
         // We use LinkLibraryDependencies="true" to link to it without

+ 2 - 2
Source/cmGlobalVisualStudio8Generator.h

@@ -72,14 +72,14 @@ protected:
   bool AddCheckTarget();
 
   /** Return true if the configuration needs to be deployed */
-  virtual bool NeedsDeploy(cmState::TargetType type) const;
+  virtual bool NeedsDeploy(cmStateEnums::TargetType type) const;
 
   static cmIDEFlagTable const* GetExtraFlagTableVS8();
   virtual void WriteSLNHeader(std::ostream& fout);
   virtual void WriteSolutionConfigurations(
     std::ostream& fout, std::vector<std::string> const& configs);
   virtual void WriteProjectConfigurations(
-    std::ostream& fout, const std::string& name, cmState::TargetType type,
+    std::ostream& fout, const std::string& name, cmStateEnums::TargetType type,
     std::vector<std::string> const& configs,
     const std::set<std::string>& configsPartOfDefaultBuild,
     const std::string& platformMapping = "");

+ 12 - 10
Source/cmGlobalVisualStudioGenerator.cxx

@@ -10,6 +10,7 @@
 #include "cmLocalVisualStudioGenerator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
+#include "cmState.h"
 #include "cmTarget.h"
 #include <cmsys/Encoding.hxx>
 
@@ -81,7 +82,8 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
         for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
              t != targets.end(); ++t) {
           cmGeneratorTarget* tgt = *t;
-          if (tgt->GetType() == cmState::GLOBAL_TARGET || tgt->IsImported()) {
+          if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
+              tgt->IsImported()) {
             continue;
           }
           if (!this->IsExcluded(gen[0], tgt)) {
@@ -265,11 +267,11 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target)
 void cmGlobalVisualStudioGenerator::FollowLinkDepends(
   const cmGeneratorTarget* target, std::set<const cmGeneratorTarget*>& linked)
 {
-  if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return;
   }
   if (linked.insert(target).second &&
-      target->GetType() == cmState::STATIC_LIBRARY) {
+      target->GetType() == cmStateEnums::STATIC_LIBRARY) {
     // Static library targets do not list their link dependencies so
     // we must follow them transitively now.
     TargetDependSet const& depends = this->GetTargetDirectDepends(target);
@@ -304,7 +306,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
 
 static bool VSLinkable(cmGeneratorTarget const* t)
 {
-  return t->IsLinkable() || t->GetType() == cmState::OBJECT_LIBRARY;
+  return t->IsLinkable() || t->GetType() == cmStateEnums::OBJECT_LIBRARY;
 }
 
 void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
@@ -333,10 +335,10 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
   // leaving them out for the static library itself but following them
   // transitively for other targets.
 
-  bool allowLinkable = (target->GetType() != cmState::STATIC_LIBRARY &&
-                        target->GetType() != cmState::SHARED_LIBRARY &&
-                        target->GetType() != cmState::MODULE_LIBRARY &&
-                        target->GetType() != cmState::EXECUTABLE);
+  bool allowLinkable = (target->GetType() != cmStateEnums::STATIC_LIBRARY &&
+                        target->GetType() != cmStateEnums::SHARED_LIBRARY &&
+                        target->GetType() != cmStateEnums::MODULE_LIBRARY &&
+                        target->GetType() != cmStateEnums::EXECUTABLE);
 
   TargetDependSet const& depends = this->GetTargetDirectDepends(target);
 
@@ -344,7 +346,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
   // Static libraries cannot depend on their link implementation
   // due to behavior (2), but they do not really need to.
   std::set<cmGeneratorTarget const*> linkDepends;
-  if (target->GetType() != cmState::STATIC_LIBRARY) {
+  if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
     for (TargetDependSet::const_iterator di = depends.begin();
          di != depends.end(); ++di) {
       cmTargetDepend dep = *di;
@@ -367,7 +369,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
   // Collect all targets linked by this target so we can avoid
   // intermediate targets below.
   TargetSet linked;
-  if (target->GetType() != cmState::STATIC_LIBRARY) {
+  if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
     linked = this->GetTargetLinkClosure(target);
   }
 

+ 1 - 0
Source/cmGlobalWatcomWMakeGenerator.cxx

@@ -5,6 +5,7 @@
 #include "cmDocumentationEntry.h"
 #include "cmMakefile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmake.h"
 
 cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)

+ 70 - 69
Source/cmGlobalXCodeGenerator.cxx

@@ -257,7 +257,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(
         "Semicolon separated list of supported configuration types, "
         "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
         "anything else will be ignored.",
-        cmState::STRING);
+        cmStateEnums::STRING);
     }
   }
   mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
@@ -444,7 +444,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
          l != tgts.end(); l++) {
       cmGeneratorTarget* target = *l;
 
-      if (target->GetType() == cmState::GLOBAL_TARGET) {
+      if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
         continue;
       }
 
@@ -459,12 +459,12 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
       // this will make sure that when the next target is built
       // things are up-to-date
       if (!makeHelper.empty() &&
-          (target->GetType() == cmState::EXECUTABLE ||
+          (target->GetType() == cmStateEnums::EXECUTABLE ||
            // Nope - no post-build for OBJECT_LIRBRARY
-           //          target->GetType() == cmState::OBJECT_LIBRARY ||
-           target->GetType() == cmState::STATIC_LIBRARY ||
-           target->GetType() == cmState::SHARED_LIBRARY ||
-           target->GetType() == cmState::MODULE_LIBRARY)) {
+           //          target->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+           target->GetType() == cmStateEnums::STATIC_LIBRARY ||
+           target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+           target->GetType() == cmStateEnums::MODULE_LIBRARY)) {
         makeHelper[makeHelper.size() - 1] = // fill placeholder
           this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)");
         cmCustomCommandLines commandLines;
@@ -475,7 +475,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
           cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str());
       }
 
-      if (target->GetType() != cmState::INTERFACE_LIBRARY &&
+      if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
           !target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
         allbuild->AddUtility(target->GetName());
       }
@@ -955,12 +955,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
       continue;
     }
 
-    if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
 
-    if (gtgt->GetType() == cmState::UTILITY ||
-        gtgt->GetType() == cmState::GLOBAL_TARGET) {
+    if (gtgt->GetType() == cmStateEnums::UTILITY ||
+        gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) {
       cmXCodeObject* t = this->CreateUtilityTarget(gtgt);
       if (!t) {
         return false;
@@ -1188,9 +1188,9 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguages()
 void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
 {
   // This matters only for targets that link.
-  if (gtgt->GetType() != cmState::EXECUTABLE &&
-      gtgt->GetType() != cmState::SHARED_LIBRARY &&
-      gtgt->GetType() != cmState::MODULE_LIBRARY) {
+  if (gtgt->GetType() != cmStateEnums::EXECUTABLE &&
+      gtgt->GetType() != cmStateEnums::SHARED_LIBRARY &&
+      gtgt->GetType() != cmStateEnums::MODULE_LIBRARY) {
     return;
   }
 
@@ -1268,7 +1268,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(
   std::vector<cmCustomCommand> const& prelink = gtgt->GetPreLinkCommands();
   std::vector<cmCustomCommand> postbuild = gtgt->GetPostBuildCommands();
 
-  if (gtgt->GetType() == cmState::SHARED_LIBRARY &&
+  if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
       !gtgt->IsFrameworkOnApple()) {
     cmCustomCommandLines cmd;
     cmd.resize(1);
@@ -1590,16 +1590,16 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
                                                  cmXCodeObject* buildSettings,
                                                  const std::string& configName)
 {
-  if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return;
   }
 
   std::string defFlags;
-  bool shared = ((gtgt->GetType() == cmState::SHARED_LIBRARY) ||
-                 (gtgt->GetType() == cmState::MODULE_LIBRARY));
-  bool binary = ((gtgt->GetType() == cmState::OBJECT_LIBRARY) ||
-                 (gtgt->GetType() == cmState::STATIC_LIBRARY) ||
-                 (gtgt->GetType() == cmState::EXECUTABLE) || shared);
+  bool shared = ((gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) ||
+                 (gtgt->GetType() == cmStateEnums::MODULE_LIBRARY));
+  bool binary = ((gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
+                 (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) ||
+                 (gtgt->GetType() == cmStateEnums::EXECUTABLE) || shared);
 
   // Compute the compilation flags for each language.
   std::set<std::string> languages;
@@ -1653,11 +1653,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
 
   std::string extraLinkOptionsVar;
   std::string extraLinkOptions;
-  if (gtgt->GetType() == cmState::EXECUTABLE) {
+  if (gtgt->GetType() == cmStateEnums::EXECUTABLE) {
     extraLinkOptionsVar = "CMAKE_EXE_LINKER_FLAGS";
-  } else if (gtgt->GetType() == cmState::SHARED_LIBRARY) {
+  } else if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
     extraLinkOptionsVar = "CMAKE_SHARED_LINKER_FLAGS";
-  } else if (gtgt->GetType() == cmState::MODULE_LIBRARY) {
+  } else if (gtgt->GetType() == cmStateEnums::MODULE_LIBRARY) {
     extraLinkOptionsVar = "CMAKE_MODULE_LINKER_FLAGS";
   }
   if (!extraLinkOptionsVar.empty()) {
@@ -1665,8 +1665,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
       extraLinkOptions, extraLinkOptionsVar, configName);
   }
 
-  if (gtgt->GetType() == cmState::OBJECT_LIBRARY ||
-      gtgt->GetType() == cmState::STATIC_LIBRARY) {
+  if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+      gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) {
     this->CurrentLocalGenerator->GetStaticLibraryFlags(
       extraLinkOptions, cmSystemTools::UpperCase(configName), gtgt);
   } else {
@@ -1736,10 +1736,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
 
   // Set attributes to specify the proper name for the target.
   std::string pndir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
-  if (gtgt->GetType() == cmState::STATIC_LIBRARY ||
-      gtgt->GetType() == cmState::SHARED_LIBRARY ||
-      gtgt->GetType() == cmState::MODULE_LIBRARY ||
-      gtgt->GetType() == cmState::EXECUTABLE) {
+  if (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY ||
+      gtgt->GetType() == cmStateEnums::SHARED_LIBRARY ||
+      gtgt->GetType() == cmStateEnums::MODULE_LIBRARY ||
+      gtgt->GetType() == cmStateEnums::EXECUTABLE) {
     if (this->XcodeVersion >= 21) {
       if (!gtgt->UsesDefaultOutputDir(configName, false)) {
         std::string pncdir = gtgt->GetDirectory(configName);
@@ -1759,7 +1759,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
                                 this->CreateString(pnprefix));
     buildSettings->AddAttribute("EXECUTABLE_SUFFIX",
                                 this->CreateString(pnsuffix));
-  } else if (gtgt->GetType() == cmState::OBJECT_LIBRARY) {
+  } else if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
     pnprefix = "lib";
     pnbase = gtgt->GetName();
     pnsuffix = ".a";
@@ -1782,14 +1782,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
 
   // Handle settings for each target type.
   switch (gtgt->GetType()) {
-    case cmState::OBJECT_LIBRARY:
-    case cmState::STATIC_LIBRARY: {
+    case cmStateEnums::OBJECT_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY: {
       buildSettings->AddAttribute("LIBRARY_STYLE",
                                   this->CreateString("STATIC"));
       break;
     }
 
-    case cmState::MODULE_LIBRARY: {
+    case cmStateEnums::MODULE_LIBRARY: {
       buildSettings->AddAttribute("LIBRARY_STYLE",
                                   this->CreateString("BUNDLE"));
       if (gtgt->IsCFBundleOnApple()) {
@@ -1839,7 +1839,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
       }
       break;
     }
-    case cmState::SHARED_LIBRARY: {
+    case cmStateEnums::SHARED_LIBRARY: {
       if (gtgt->GetPropertyAsBool("FRAMEWORK")) {
         std::string fw_version = gtgt->GetFrameworkVersion();
         buildSettings->AddAttribute("FRAMEWORK_VERSION",
@@ -1872,7 +1872,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
                                   this->CreateString("DYNAMIC"));
       break;
     }
-    case cmState::EXECUTABLE: {
+    case cmStateEnums::EXECUTABLE: {
       // Add the flags to create an executable.
       std::string createFlags =
         this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", "");
@@ -2051,7 +2051,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
 
   // Create the INSTALL_PATH attribute.
   std::string install_name_dir;
-  if (gtgt->GetType() == cmState::SHARED_LIBRARY) {
+  if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
     // Get the install_name directory for the build tree.
     install_name_dir = gtgt->GetInstallNameDirForBuildTree(configName);
     // Xcode doesn't create the correct install_name in some cases.
@@ -2124,7 +2124,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
   }
 
   // Runtime version information.
-  if (gtgt->GetType() == cmState::SHARED_LIBRARY) {
+  if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
     int major;
     int minor;
     int patch;
@@ -2219,7 +2219,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
   this->XCodeObjectMap[gtgt] = target;
 
   // Add source files without build rules for editing convenience.
-  if (gtgt->GetType() == cmState::UTILITY) {
+  if (gtgt->GetType() == cmStateEnums::UTILITY) {
     std::vector<cmSourceFile*> sources;
     if (!gtgt->GetConfigCommonSourceFiles(sources)) {
       return 0;
@@ -2285,8 +2285,8 @@ const char* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(
   cmGeneratorTarget const* target) const
 {
   if (this->XcodeVersion >= 60 &&
-      (target->GetType() == cmState::STATIC_LIBRARY ||
-       target->GetType() == cmState::OBJECT_LIBRARY)) {
+      (target->GetType() == cmStateEnums::STATIC_LIBRARY ||
+       target->GetType() == cmStateEnums::OBJECT_LIBRARY)) {
     return "OTHER_LIBTOOLFLAGS";
   } else {
     return "OTHER_LDFLAGS";
@@ -2297,10 +2297,10 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
   cmGeneratorTarget* target)
 {
   switch (target->GetType()) {
-    case cmState::OBJECT_LIBRARY:
-    case cmState::STATIC_LIBRARY:
+    case cmStateEnums::OBJECT_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
       return "archive.ar";
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       if (target->IsXCTestOnApple())
         return "wrapper.cfbundle";
       else if (target->IsCFBundleOnApple())
@@ -2308,11 +2308,11 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
       else
         return ((this->XcodeVersion >= 22) ? "compiled.mach-o.executable"
                                            : "compiled.mach-o.dylib");
-    case cmState::SHARED_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
       return (target->GetPropertyAsBool("FRAMEWORK")
                 ? "wrapper.framework"
                 : "compiled.mach-o.dylib");
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       return "compiled.mach-o.executable";
     default:
       break;
@@ -2324,10 +2324,10 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
   cmGeneratorTarget* target)
 {
   switch (target->GetType()) {
-    case cmState::OBJECT_LIBRARY:
-    case cmState::STATIC_LIBRARY:
+    case cmStateEnums::OBJECT_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
       return "com.apple.product-type.library.static";
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       if (target->IsXCTestOnApple())
         return "com.apple.product-type.bundle.unit-test";
       else if (target->IsCFBundleOnApple())
@@ -2336,11 +2336,11 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
         return ((this->XcodeVersion >= 22)
                   ? "com.apple.product-type.tool"
                   : "com.apple.product-type.library.dynamic");
-    case cmState::SHARED_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
       return (target->GetPropertyAsBool("FRAMEWORK")
                 ? "com.apple.product-type.framework"
                 : "com.apple.product-type.library.dynamic");
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       return (target->GetPropertyAsBool("MACOSX_BUNDLE")
                 ? "com.apple.product-type.application"
                 : "com.apple.product-type.tool");
@@ -2353,7 +2353,7 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
 cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
   cmGeneratorTarget* gtgt, cmXCodeObject* buildPhases)
 {
-  if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return 0;
   }
   cmXCodeObject* target = this->CreateObject(cmXCodeObject::PBXNativeTarget);
@@ -2380,7 +2380,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
     fileRef->AddAttribute("explicitFileType", this->CreateString(fileType));
   }
   std::string fullName;
-  if (gtgt->GetType() == cmState::OBJECT_LIBRARY) {
+  if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
     fullName = "lib";
     fullName += gtgt->GetName();
     fullName += ".a";
@@ -2432,8 +2432,9 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name,
     return storedGUID;
   }
 
-  this->CMakeInstance->AddCacheEntry(
-    guidStoreName, id.c_str(), "Stored Xcode object GUID", cmState::INTERNAL);
+  this->CMakeInstance->AddCacheEntry(guidStoreName, id.c_str(),
+                                     "Stored Xcode object GUID",
+                                     cmStateEnums::INTERNAL);
 
   return id;
 }
@@ -2527,7 +2528,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
     cmSystemTools::Error("Error no target on xobject\n");
     return;
   }
-  if (gt->GetType() == cmState::INTERFACE_LIBRARY) {
+  if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     return;
   }
 
@@ -2564,8 +2565,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
     }
 
     // Skip link information for object libraries.
-    if (gt->GetType() == cmState::OBJECT_LIBRARY ||
-        gt->GetType() == cmState::STATIC_LIBRARY) {
+    if (gt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+        gt->GetType() == cmStateEnums::STATIC_LIBRARY) {
       continue;
     }
 
@@ -2620,7 +2621,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
         if (li->IsPath) {
           linkLibs += this->XCodeEscapePath(li->Value);
         } else if (!li->Target ||
-                   li->Target->GetType() != cmState::INTERFACE_LIBRARY) {
+                   li->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
           linkLibs += li->Value;
         }
         if (li->Target && !li->Target->IsImported()) {
@@ -2649,10 +2650,10 @@ bool cmGlobalXCodeGenerator::CreateGroups(
       // end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source
       // groups:
       //
-      if (gtgt->GetType() == cmState::GLOBAL_TARGET) {
+      if (gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) {
         continue;
       }
-      if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) {
+      if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
         continue;
       }
 
@@ -3149,20 +3150,20 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
       cmXCodeObject* target = *i;
       cmGeneratorTarget* gt = target->GetTarget();
 
-      if (gt->GetType() == cmState::EXECUTABLE ||
+      if (gt->GetType() == cmStateEnums::EXECUTABLE ||
           // Nope - no post-build for OBJECT_LIRBRARY
-          //         gt->GetType() == cmState::OBJECT_LIBRARY ||
-          gt->GetType() == cmState::STATIC_LIBRARY ||
-          gt->GetType() == cmState::SHARED_LIBRARY ||
-          gt->GetType() == cmState::MODULE_LIBRARY) {
+          //         gt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+          gt->GetType() == cmStateEnums::STATIC_LIBRARY ||
+          gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
+          gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
         // Declare an entry point for the target post-build phase.
         makefileStream << this->PostBuildMakeTarget(gt->GetName(), *ct)
                        << ":\n";
       }
 
-      if (gt->GetType() == cmState::EXECUTABLE ||
-          gt->GetType() == cmState::SHARED_LIBRARY ||
-          gt->GetType() == cmState::MODULE_LIBRARY) {
+      if (gt->GetType() == cmStateEnums::EXECUTABLE ||
+          gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
+          gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
         std::string tfull = gt->GetFullPath(configName);
         std::string trel = this->ConvertToRelativeForMake(tfull.c_str());
 

+ 9 - 9
Source/cmGraphVizWriter.cxx

@@ -24,13 +24,13 @@ static const char* getShapeForTarget(const cmGeneratorTarget* target)
   }
 
   switch (target->GetType()) {
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       return "house";
-    case cmState::STATIC_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
       return "diamond";
-    case cmState::SHARED_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
       return "polygon";
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       return "octagon";
     default:
       break;
@@ -495,16 +495,16 @@ bool cmGraphVizWriter::IgnoreThisTarget(const std::string& name)
 }
 
 bool cmGraphVizWriter::GenerateForTargetType(
-  cmState::TargetType targetType) const
+  cmStateEnums::TargetType targetType) const
 {
   switch (targetType) {
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       return this->GenerateForExecutables;
-    case cmState::STATIC_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
       return this->GenerateForStaticLibs;
-    case cmState::SHARED_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
       return this->GenerateForSharedLibs;
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       return this->GenerateForModuleLibs;
     default:
       break;

+ 2 - 2
Source/cmGraphVizWriter.h

@@ -5,7 +5,7 @@
 
 #include <cmConfigure.h> // IWYU pragma: keep
 
-#include "cmState.h"
+#include "cmStateTypes.h"
 
 #include <cmsys/RegularExpression.hxx>
 #include <map>
@@ -60,7 +60,7 @@ protected:
 
   bool IgnoreThisTarget(const std::string& name);
 
-  bool GenerateForTargetType(cmState::TargetType targetType) const;
+  bool GenerateForTargetType(cmStateEnums::TargetType targetType) const;
 
   std::string GraphType;
   std::string GraphName;

+ 3 - 3
Source/cmIncludeExternalMSProjectCommand.cxx

@@ -66,12 +66,12 @@ bool cmIncludeExternalMSProjectCommand::InitialPass(
       std::string guidVariable = utility_name + "_GUID_CMAKE";
       this->Makefile->GetCMakeInstance()->AddCacheEntry(
         guidVariable.c_str(), customGuid.c_str(), "Stored GUID",
-        cmState::INTERNAL);
+        cmStateEnums::INTERNAL);
     }
 
     // Create a target instance for this utility.
-    cmTarget* target =
-      this->Makefile->AddNewTarget(cmState::UTILITY, utility_name.c_str());
+    cmTarget* target = this->Makefile->AddNewTarget(cmStateEnums::UTILITY,
+                                                    utility_name.c_str());
 
     target->SetProperty("GENERATOR_FILE_NAME", utility_name.c_str());
     target->SetProperty("EXTERNAL_MSPROJECT", path.c_str());

+ 13 - 13
Source/cmInstallCommand.cxx

@@ -327,19 +327,19 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
     if (cmTarget* target =
           this->Makefile->FindLocalNonAliasTarget(*targetIt)) {
       // Found the target.  Check its type.
-      if (target->GetType() != cmState::EXECUTABLE &&
-          target->GetType() != cmState::STATIC_LIBRARY &&
-          target->GetType() != cmState::SHARED_LIBRARY &&
-          target->GetType() != cmState::MODULE_LIBRARY &&
-          target->GetType() != cmState::OBJECT_LIBRARY &&
-          target->GetType() != cmState::INTERFACE_LIBRARY) {
+      if (target->GetType() != cmStateEnums::EXECUTABLE &&
+          target->GetType() != cmStateEnums::STATIC_LIBRARY &&
+          target->GetType() != cmStateEnums::SHARED_LIBRARY &&
+          target->GetType() != cmStateEnums::MODULE_LIBRARY &&
+          target->GetType() != cmStateEnums::OBJECT_LIBRARY &&
+          target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
         std::ostringstream e;
         e << "TARGETS given target \"" << (*targetIt)
           << "\" which is not an executable, library, or module.";
         this->SetError(e.str());
         return false;
       }
-      if (target->GetType() == cmState::OBJECT_LIBRARY) {
+      if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
         std::ostringstream e;
         e << "TARGETS given OBJECT library \"" << (*targetIt)
           << "\" which may not be installed.";
@@ -387,7 +387,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
     bool namelinkOnly = false;
 
     switch (target.GetType()) {
-      case cmState::SHARED_LIBRARY: {
+      case cmStateEnums::SHARED_LIBRARY: {
         // Shared libraries are handled differently on DLL and non-DLL
         // platforms.  All windows platforms are DLL platforms including
         // cygwin.  Currently no other platform is a DLL platform.
@@ -454,7 +454,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
           }
         }
       } break;
-      case cmState::STATIC_LIBRARY: {
+      case cmStateEnums::STATIC_LIBRARY: {
         // Static libraries use ARCHIVE properties.
         if (!archiveArgs.GetDestination().empty()) {
           archiveGenerator =
@@ -468,7 +468,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
           return false;
         }
       } break;
-      case cmState::MODULE_LIBRARY: {
+      case cmStateEnums::MODULE_LIBRARY: {
         // Modules use LIBRARY properties.
         if (!libraryArgs.GetDestination().empty()) {
           libraryGenerator =
@@ -484,7 +484,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
           return false;
         }
       } break;
-      case cmState::EXECUTABLE: {
+      case cmStateEnums::EXECUTABLE: {
         if (target.IsAppBundleOnApple()) {
           // Application bundles use the BUNDLE properties.
           if (!bundleArgs.GetDestination().empty()) {
@@ -534,7 +534,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
             CreateInstallTargetGenerator(target, archiveArgs, true, true);
         }
       } break;
-      case cmState::INTERFACE_LIBRARY:
+      case cmStateEnums::INTERFACE_LIBRARY:
         // Nothing to do. An INTERFACE_LIBRARY can be installed, but the
         // only effect of that is to make it exportable. It installs no
         // other files itself.
@@ -553,7 +553,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
     bool createInstallGeneratorsForTargetFileSets = true;
 
     if (target.IsFrameworkOnApple() ||
-        target.GetType() == cmState::INTERFACE_LIBRARY) {
+        target.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       createInstallGeneratorsForTargetFileSets = false;
     }
 

+ 23 - 23
Source/cmInstallTargetGenerator.cxx

@@ -9,7 +9,7 @@
 #include "cmInstallType.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cm_auto_ptr.hxx"
@@ -80,36 +80,36 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
   std::vector<std::string> filesFrom;
   std::vector<std::string> filesTo;
   std::string literal_args;
-  cmState::TargetType targetType = this->Target->GetType();
+  cmStateEnums::TargetType targetType = this->Target->GetType();
   cmInstallType type = cmInstallType();
   switch (targetType) {
-    case cmState::EXECUTABLE:
+    case cmStateEnums::EXECUTABLE:
       type = cmInstallType_EXECUTABLE;
       break;
-    case cmState::STATIC_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
       type = cmInstallType_STATIC_LIBRARY;
       break;
-    case cmState::SHARED_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
       type = cmInstallType_SHARED_LIBRARY;
       break;
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       type = cmInstallType_MODULE_LIBRARY;
       break;
-    case cmState::INTERFACE_LIBRARY:
+    case cmStateEnums::INTERFACE_LIBRARY:
       // Not reachable. We never create a cmInstallTargetGenerator for
       // an INTERFACE_LIBRARY.
       assert(0 && "INTERFACE_LIBRARY targets have no installable outputs.");
       break;
-    case cmState::OBJECT_LIBRARY:
-    case cmState::UTILITY:
-    case cmState::GLOBAL_TARGET:
-    case cmState::UNKNOWN_LIBRARY:
+    case cmStateEnums::OBJECT_LIBRARY:
+    case cmStateEnums::UTILITY:
+    case cmStateEnums::GLOBAL_TARGET:
+    case cmStateEnums::UNKNOWN_LIBRARY:
       this->Target->GetLocalGenerator()->IssueMessage(
         cmake::INTERNAL_ERROR,
         "cmInstallTargetGenerator created with non-installable target.");
       return;
   }
-  if (targetType == cmState::EXECUTABLE) {
+  if (targetType == cmStateEnums::EXECUTABLE) {
     // There is a bug in cmInstallCommand if this fails.
     assert(this->NamelinkMode == NamelinkModeNone);
 
@@ -337,7 +337,7 @@ std::string cmInstallTargetGenerator::GetInstallFilename(
 {
   std::string fname;
   // Compute the name of the library.
-  if (target->GetType() == cmState::EXECUTABLE) {
+  if (target->GetType() == cmStateEnums::EXECUTABLE) {
     std::string targetName;
     std::string targetNameReal;
     std::string targetNameImport;
@@ -471,9 +471,9 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule(
   std::string const& toDestDirPath)
 {
   if (this->ImportLibrary ||
-      !(this->Target->GetType() == cmState::SHARED_LIBRARY ||
-        this->Target->GetType() == cmState::MODULE_LIBRARY ||
-        this->Target->GetType() == cmState::EXECUTABLE)) {
+      !(this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+        this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
+        this->Target->GetType() == cmStateEnums::EXECUTABLE)) {
     return;
   }
 
@@ -527,7 +527,7 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule(
 
   // Edit the install_name of the target itself if necessary.
   std::string new_id;
-  if (this->Target->GetType() == cmState::SHARED_LIBRARY) {
+  if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
     std::string for_build =
       this->Target->GetInstallNameDirForBuildTree(config);
     std::string for_install = this->Target->GetInstallNameDirForInstallTree();
@@ -704,7 +704,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os,
 
   // don't strip static and import libraries, because it removes the only
   // symbol table they have so you can't link to them anymore
-  if (this->Target->GetType() == cmState::STATIC_LIBRARY ||
+  if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
       this->ImportLibrary) {
     return;
   }
@@ -731,7 +731,7 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
                                              const std::string& toDestDirPath)
 {
   // Static libraries need ranlib on this platform.
-  if (this->Target->GetType() != cmState::STATIC_LIBRARY) {
+  if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) {
     return;
   }
 
@@ -767,10 +767,10 @@ void cmInstallTargetGenerator::AddUniversalInstallRule(
   }
 
   switch (this->Target->GetType()) {
-    case cmState::EXECUTABLE:
-    case cmState::STATIC_LIBRARY:
-    case cmState::SHARED_LIBRARY:
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::EXECUTABLE:
+    case cmStateEnums::STATIC_LIBRARY:
+    case cmStateEnums::SHARED_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       break;
 
     default:

+ 4 - 2
Source/cmLinkLineComputer.cxx

@@ -5,9 +5,10 @@
 #include "cmComputeLinkInformation.h"
 #include "cmGeneratorTarget.h"
 #include "cmOutputConverter.h"
+#include "cmStateDirectory.h"
 
 cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter,
-                                       cmState::Directory stateDir)
+                                       cmStateDirectory stateDir)
   : StateDir(stateDir)
   , OutputConverter(outputConverter)
   , ForResponse(false)
@@ -55,7 +56,8 @@ std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli)
   ItemVector const& items = cli.GetItems();
   for (ItemVector::const_iterator li = items.begin(); li != items.end();
        ++li) {
-    if (li->Target && li->Target->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (li->Target &&
+        li->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     if (li->IsPath) {

+ 3 - 3
Source/cmLinkLineComputer.h

@@ -4,7 +4,7 @@
 #ifndef cmLinkLineComputer_h
 #define cmLinkLineComputer_h
 
-#include "cmState.h"
+#include "cmStateDirectory.h"
 
 class cmComputeLinkInformation;
 class cmOutputConverter;
@@ -13,7 +13,7 @@ class cmLinkLineComputer
 {
 public:
   cmLinkLineComputer(cmOutputConverter* outputConverter,
-                     cmState::Directory stateDir);
+                     cmStateDirectory stateDir);
   virtual ~cmLinkLineComputer();
 
   void SetUseWatcomQuote(bool useWatcomQuote);
@@ -39,7 +39,7 @@ private:
   std::string ConvertToOutputFormat(std::string const& input);
   std::string ConvertToOutputForExisting(std::string const& input);
 
-  cmState::Directory StateDir;
+  cmStateDirectory StateDir;
   cmOutputConverter* OutputConverter;
 
   bool ForResponse;

+ 4 - 3
Source/cmListFileCache.cxx

@@ -5,6 +5,7 @@
 #include "cmListFileLexer.h"
 #include "cmMessenger.h"
 #include "cmOutputConverter.h"
+#include "cmState.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
@@ -298,7 +299,7 @@ struct cmListFileBacktrace::Entry : public cmListFileContext
   unsigned int RefCount;
 };
 
-cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
+cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot bottom, Entry* up,
                                          cmListFileContext const& lfc)
   : Bottom(bottom)
   , Cur(new Entry(lfc, up))
@@ -307,7 +308,7 @@ cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
   this->Cur->Ref();
 }
 
-cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur)
+cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot bottom, Entry* cur)
   : Bottom(bottom)
   , Cur(cur)
 {
@@ -323,7 +324,7 @@ cmListFileBacktrace::cmListFileBacktrace()
 {
 }
 
-cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot snapshot)
+cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot snapshot)
   : Bottom(snapshot.GetCallStackBottom())
   , Cur(CM_NULLPTR)
 {

+ 6 - 6
Source/cmListFileCache.h

@@ -9,7 +9,7 @@
 #include <string>
 #include <vector>
 
-#include "cmState.h"
+#include "cmStateSnapshot.h"
 
 /** \class cmListFileCache
  * \brief A class to cache list file contents.
@@ -113,14 +113,14 @@ public:
 
   // Construct an empty backtrace whose bottom sits in the directory
   // indicated by the given valid snapshot.
-  cmListFileBacktrace(cmState::Snapshot snapshot);
+  cmListFileBacktrace(cmStateSnapshot snapshot);
 
   // Backtraces may be copied and assigned as values.
   cmListFileBacktrace(cmListFileBacktrace const& r);
   cmListFileBacktrace& operator=(cmListFileBacktrace const& r);
   ~cmListFileBacktrace();
 
-  cmState::Snapshot GetBottom() const { return this->Bottom; }
+  cmStateSnapshot GetBottom() const { return this->Bottom; }
 
   // Get a backtrace with the given file scope added to the top.
   // May not be called until after construction with a valid snapshot.
@@ -147,11 +147,11 @@ public:
 private:
   struct Entry;
 
-  cmState::Snapshot Bottom;
+  cmStateSnapshot Bottom;
   Entry* Cur;
-  cmListFileBacktrace(cmState::Snapshot bottom, Entry* up,
+  cmListFileBacktrace(cmStateSnapshot bottom, Entry* up,
                       cmListFileContext const& lfc);
-  cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur);
+  cmListFileBacktrace(cmStateSnapshot bottom, Entry* cur);
 };
 
 struct cmListFile

+ 1 - 1
Source/cmLoadCacheCommand.cxx

@@ -140,7 +140,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
   // Check one line of the cache file.
   std::string var;
   std::string value;
-  cmState::CacheEntryType type = cmState::UNINITIALIZED;
+  cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED;
   if (cmake::ParseCacheEntry(line, var, value, type)) {
     // Found a real entry.  See if this one was requested.
     if (this->VariablesToRead.find(var) != this->VariablesToRead.end()) {

+ 36 - 34
Source/cmLocalGenerator.cxx

@@ -16,6 +16,8 @@
 #include "cmMakefile.h"
 #include "cmRulePlaceholderExpander.h"
 #include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTestGenerator.h"
@@ -199,7 +201,7 @@ void cmLocalGenerator::TraceDependencies()
   std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
   for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
        t != targets.end(); ++t) {
-    if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) {
+    if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     (*t)->TraceDependencies();
@@ -249,7 +251,7 @@ void cmLocalGenerator::GenerateTestFiles()
     (*gi)->Compute(this);
     (*gi)->Generate(fout, config, configurationTypes);
   }
-  typedef std::vector<cmState::Snapshot> vec_t;
+  typedef std::vector<cmStateSnapshot> vec_t;
   vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren();
   std::string parentBinDir = this->GetCurrentBinaryDirectory();
   for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) {
@@ -446,12 +448,12 @@ void cmLocalGenerator::GenerateInstallRules()
   this->GenerateTargetInstallRules(fout, config, configurationTypes);
 
   // Include install scripts from subdirectories.
-  std::vector<cmState::Snapshot> children =
+  std::vector<cmStateSnapshot> children =
     this->Makefile->GetStateSnapshot().GetChildren();
   if (!children.empty()) {
     fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
     fout << "  # Include the install script for each subdirectory.\n";
-    for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
+    for (std::vector<cmStateSnapshot>::const_iterator ci = children.begin();
          ci != children.end(); ++ci) {
       if (!ci->GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
         std::string odir = ci->GetDirectory().GetCurrentBinary();
@@ -542,7 +544,7 @@ void cmLocalGenerator::ComputeTargetManifest()
   for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
        t != targets.end(); ++t) {
     cmGeneratorTarget* target = *t;
-    if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     for (std::vector<std::string>::iterator ci = configNames.begin();
@@ -563,7 +565,7 @@ cmState* cmLocalGenerator::GetState() const
   return this->GlobalGenerator->GetCMakeInstance()->GetState();
 }
 
-cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
+cmStateSnapshot cmLocalGenerator::GetStateSnapshot() const
 {
   return this->Makefile->GetStateSnapshot();
 }
@@ -911,12 +913,12 @@ void cmLocalGenerator::GetTargetFlags(
     "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
 
   switch (target->GetType()) {
-    case cmState::STATIC_LIBRARY:
+    case cmStateEnums::STATIC_LIBRARY:
       this->GetStaticLibraryFlags(linkFlags, buildType, target);
       break;
-    case cmState::MODULE_LIBRARY:
+    case cmStateEnums::MODULE_LIBRARY:
       libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
-    case cmState::SHARED_LIBRARY: {
+    case cmStateEnums::SHARED_LIBRARY: {
       linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable);
       linkFlags += " ";
       if (!buildType.empty()) {
@@ -962,7 +964,7 @@ void cmLocalGenerator::GetTargetFlags(
                                   frameworkPath, linkPath);
       }
     } break;
-    case cmState::EXECUTABLE: {
+    case cmStateEnums::EXECUTABLE: {
       linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
       linkFlags += " ";
       if (!buildType.empty()) {
@@ -1189,7 +1191,7 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065(
   std::string linkFlags;
 
   // Flags to link an executable to shared libraries.
-  if (tgt.GetType() == cmState::EXECUTABLE &&
+  if (tgt.GetType() == cmStateEnums::EXECUTABLE &&
       this->StateSnapshot.GetState()->GetGlobalPropertyAsBool(
         "TARGET_SUPPORTS_SHARED_LIBS")) {
     bool add_shlib_flags = false;
@@ -1334,8 +1336,8 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
     // found is part of the inName
     if (cmSystemTools::FileIsFullPath(inName.c_str())) {
       std::string tLocation;
-      if (target->GetType() >= cmState::EXECUTABLE &&
-          target->GetType() <= cmState::MODULE_LIBRARY) {
+      if (target->GetType() >= cmStateEnums::EXECUTABLE &&
+          target->GetType() <= cmStateEnums::MODULE_LIBRARY) {
         tLocation = target->GetLocation(config);
         tLocation = cmSystemTools::GetFilenamePath(tLocation);
         tLocation = cmSystemTools::CollapseFullPath(tLocation);
@@ -1352,23 +1354,23 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
       }
     }
     switch (target->GetType()) {
-      case cmState::EXECUTABLE:
-      case cmState::STATIC_LIBRARY:
-      case cmState::SHARED_LIBRARY:
-      case cmState::MODULE_LIBRARY:
-      case cmState::UNKNOWN_LIBRARY:
+      case cmStateEnums::EXECUTABLE:
+      case cmStateEnums::STATIC_LIBRARY:
+      case cmStateEnums::SHARED_LIBRARY:
+      case cmStateEnums::MODULE_LIBRARY:
+      case cmStateEnums::UNKNOWN_LIBRARY:
         dep = target->GetLocation(config);
         return true;
-      case cmState::OBJECT_LIBRARY:
+      case cmStateEnums::OBJECT_LIBRARY:
         // An object library has no single file on which to depend.
         // This was listed to get the target-level dependency.
         return false;
-      case cmState::INTERFACE_LIBRARY:
+      case cmStateEnums::INTERFACE_LIBRARY:
         // An interface library has no file on which to depend.
         // This was listed to get the target-level dependency.
         return false;
-      case cmState::UTILITY:
-      case cmState::GLOBAL_TARGET:
+      case cmStateEnums::UTILITY:
+      case cmStateEnums::GLOBAL_TARGET:
         // A utility target has no file on which to depend.  This was listed
         // only to get the target-level dependency.
         return false;
@@ -1584,8 +1586,8 @@ void cmLocalGenerator::AddVisibilityPresetFlags(
 
   std::string warnCMP0063;
   std::string* pWarnCMP0063 = CM_NULLPTR;
-  if (target->GetType() != cmState::SHARED_LIBRARY &&
-      target->GetType() != cmState::MODULE_LIBRARY &&
+  if (target->GetType() != cmStateEnums::SHARED_LIBRARY &&
+      target->GetType() != cmStateEnums::MODULE_LIBRARY &&
       !target->IsExecutableWithExports()) {
     switch (target->GetPolicyStatusCMP0063()) {
       case cmPolicies::OLD:
@@ -1627,13 +1629,13 @@ void cmLocalGenerator::AddCMP0018Flags(std::string& flags,
 {
   int targetType = target->GetType();
 
-  bool shared = ((targetType == cmState::SHARED_LIBRARY) ||
-                 (targetType == cmState::MODULE_LIBRARY));
+  bool shared = ((targetType == cmStateEnums::SHARED_LIBRARY) ||
+                 (targetType == cmStateEnums::MODULE_LIBRARY));
 
   if (this->GetShouldUseOldFlags(shared, lang)) {
     this->AddSharedFlags(flags, lang, shared);
   } else {
-    if (target->GetType() == cmState::OBJECT_LIBRARY) {
+    if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
       if (target->GetPropertyAsBool("POSITION_INDEPENDENT_CODE")) {
         this->AddPositionIndependentFlags(flags, lang, targetType);
       }
@@ -1696,7 +1698,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
 {
   const char* picFlags = CM_NULLPTR;
 
-  if (targetType == cmState::EXECUTABLE) {
+  if (targetType == cmStateEnums::EXECUTABLE) {
     std::string flagsVar = "CMAKE_";
     flagsVar += lang;
     flagsVar += "_COMPILE_OPTIONS_PIE";
@@ -1868,7 +1870,7 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
     featureName += "_";
     featureName += cmSystemTools::UpperCase(config);
   }
-  cmState::Snapshot snp = this->StateSnapshot;
+  cmStateSnapshot snp = this->StateSnapshot;
   while (snp.IsValid()) {
     if (const char* value = snp.GetDirectory().GetProperty(featureName)) {
       return value;
@@ -1933,7 +1935,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
   std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
   for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
        l != tgts.end(); ++l) {
-    if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) {
+    if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
 
@@ -1956,15 +1958,15 @@ void cmLocalGenerator::GenerateTargetInstallRules(
 
       // Generate the proper install generator for this target type.
       switch ((*l)->GetType()) {
-        case cmState::EXECUTABLE:
-        case cmState::STATIC_LIBRARY:
-        case cmState::MODULE_LIBRARY: {
+        case cmStateEnums::EXECUTABLE:
+        case cmStateEnums::STATIC_LIBRARY:
+        case cmStateEnums::MODULE_LIBRARY: {
           // Use a target install generator.
           cmInstallTargetGeneratorLocal g(this, (*l)->GetName(),
                                           destination.c_str(), false);
           g.Generate(os, config, configurationTypes);
         } break;
-        case cmState::SHARED_LIBRARY: {
+        case cmStateEnums::SHARED_LIBRARY: {
 #if defined(_WIN32) || defined(__CYGWIN__)
           // Special code to handle DLL.  Install the import library
           // to the normal destination and the DLL to the runtime

+ 3 - 3
Source/cmLocalGenerator.h

@@ -9,7 +9,7 @@
 #include "cmOutputConverter.h"
 #include "cmPolicies.h"
 #include "cmRulePlaceholderExpander.h"
-#include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmake.h"
 
 #include <cm_kwiml.h>
@@ -92,7 +92,7 @@ public:
                                  cmGeneratorTarget& tgt) const;
 
   cmState* GetState() const;
-  cmState::Snapshot GetStateSnapshot() const;
+  cmStateSnapshot GetStateSnapshot() const;
 
   void AddArchitectureFlags(std::string& flags,
                             cmGeneratorTarget const* target,
@@ -337,7 +337,7 @@ protected:
   virtual bool CheckDefinition(std::string const& define) const;
 
   cmMakefile* Makefile;
-  cmState::Snapshot StateSnapshot;
+  cmStateSnapshot StateSnapshot;
   cmListFileBacktrace DirectoryBacktrace;
   cmGlobalGenerator* GlobalGenerator;
   std::map<std::string, std::string> UniqueObjectNamesMap;

+ 1 - 1
Source/cmLocalGhsMultiGenerator.cxx

@@ -24,7 +24,7 @@ void cmLocalGhsMultiGenerator::Generate()
 
   for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
        l != tgts.end(); ++l) {
-    if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) {
+    if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     cmGhsMultiTargetGenerator tg(*l);

+ 2 - 1
Source/cmLocalNinjaGenerator.cxx

@@ -13,6 +13,7 @@
 #include "cmRulePlaceholderExpander.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
@@ -81,7 +82,7 @@ void cmLocalNinjaGenerator::Generate()
   std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
   for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
        t != targets.end(); ++t) {
-    if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) {
+    if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(*t);

+ 11 - 9
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -17,6 +17,8 @@
 #include "cmRulePlaceholderExpander.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmVersion.h"
 #include "cmake.h"
@@ -120,7 +122,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
     static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
   for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
        t != targets.end(); ++t) {
-    if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) {
+    if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     CM_AUTO_PTR<cmMakefileTargetGenerator> tg(
@@ -172,7 +174,7 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
   for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
        ti != targets.end(); ++ti) {
     cmGeneratorTarget* gt = *ti;
-    if (gt->GetType() == cmState::INTERFACE_LIBRARY) {
+    if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
     }
     std::vector<cmSourceFile const*> objectSources;
@@ -382,12 +384,12 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
   std::string localName;
   for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
        t != targets.end(); ++t) {
-    if (((*t)->GetType() == cmState::EXECUTABLE) ||
-        ((*t)->GetType() == cmState::STATIC_LIBRARY) ||
-        ((*t)->GetType() == cmState::SHARED_LIBRARY) ||
-        ((*t)->GetType() == cmState::MODULE_LIBRARY) ||
-        ((*t)->GetType() == cmState::OBJECT_LIBRARY) ||
-        ((*t)->GetType() == cmState::UTILITY)) {
+    if (((*t)->GetType() == cmStateEnums::EXECUTABLE) ||
+        ((*t)->GetType() == cmStateEnums::STATIC_LIBRARY) ||
+        ((*t)->GetType() == cmStateEnums::SHARED_LIBRARY) ||
+        ((*t)->GetType() == cmStateEnums::MODULE_LIBRARY) ||
+        ((*t)->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
+        ((*t)->GetType() == cmStateEnums::UTILITY)) {
       emitted.insert((*t)->GetName());
 
       // for subdirs add a rule to build this specific target by name.
@@ -1558,7 +1560,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
   std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
   std::vector<cmGeneratorTarget*>::iterator glIt;
   for (glIt = targets.begin(); glIt != targets.end(); ++glIt) {
-    if ((*glIt)->GetType() == cmState::GLOBAL_TARGET) {
+    if ((*glIt)->GetType() == cmStateEnums::GLOBAL_TARGET) {
       std::string targetString =
         "Special rule for the target " + (*glIt)->GetName();
       std::vector<std::string> commands;

Некоторые файлы не были показаны из-за большого количества измененных файлов