瀏覽代碼

cmMakefile: Move enumerations into new header

The enumerations will also be used in cmLocalGenerator.
Daniel Eiband 6 年之前
父節點
當前提交
f151a57705

+ 1 - 0
Source/CMakeLists.txt

@@ -195,6 +195,7 @@ set(SRCS
   cmCustomCommandGenerator.h
   cmCustomCommandGenerator.h
   cmCustomCommandLines.cxx
   cmCustomCommandLines.cxx
   cmCustomCommandLines.h
   cmCustomCommandLines.h
+  cmCustomCommandTypes.h
   cmDefinitions.cxx
   cmDefinitions.cxx
   cmDefinitions.h
   cmDefinitions.h
   cmDepends.cxx
   cmDepends.cxx

+ 5 - 5
Source/cmAddCustomCommandCommand.cxx

@@ -8,6 +8,7 @@
 #include "cmCheckCustomOutputs.h"
 #include "cmCheckCustomOutputs.h"
 #include "cmCustomCommand.h"
 #include "cmCustomCommand.h"
 #include "cmCustomCommandLines.h"
 #include "cmCustomCommandLines.h"
+#include "cmCustomCommandTypes.h"
 #include "cmExecutionStatus.h"
 #include "cmExecutionStatus.h"
 #include "cmGlobalGenerator.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmMakefile.h"
@@ -15,7 +16,6 @@
 #include "cmPolicies.h"
 #include "cmPolicies.h"
 #include "cmStringAlgorithms.h"
 #include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmSystemTools.h"
-#include "cmTarget.h"
 
 
 bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
 bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
                                cmExecutionStatus& status)
                                cmExecutionStatus& status)
@@ -55,7 +55,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
   // Save all command lines.
   // Save all command lines.
   cmCustomCommandLines commandLines;
   cmCustomCommandLines commandLines;
 
 
-  cmTarget::CustomCommandType cctype = cmTarget::POST_BUILD;
+  cmCustomCommandType cctype = cmCustomCommandType::POST_BUILD;
 
 
   enum tdoing
   enum tdoing
   {
   {
@@ -139,11 +139,11 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
           currentLine.clear();
           currentLine.clear();
         }
         }
       } else if (copy == keyPRE_BUILD) {
       } else if (copy == keyPRE_BUILD) {
-        cctype = cmTarget::PRE_BUILD;
+        cctype = cmCustomCommandType::PRE_BUILD;
       } else if (copy == keyPRE_LINK) {
       } else if (copy == keyPRE_LINK) {
-        cctype = cmTarget::PRE_LINK;
+        cctype = cmCustomCommandType::PRE_LINK;
       } else if (copy == keyPOST_BUILD) {
       } else if (copy == keyPOST_BUILD) {
-        cctype = cmTarget::POST_BUILD;
+        cctype = cmCustomCommandType::POST_BUILD;
       } else if (copy == keyVERBATIM) {
       } else if (copy == keyVERBATIM) {
         verbatim = true;
         verbatim = true;
       } else if (copy == keyAPPEND) {
       } else if (copy == keyAPPEND) {

+ 2 - 1
Source/cmAddCustomTargetCommand.cxx

@@ -6,6 +6,7 @@
 
 
 #include "cmCheckCustomOutputs.h"
 #include "cmCheckCustomOutputs.h"
 #include "cmCustomCommandLines.h"
 #include "cmCustomCommandLines.h"
+#include "cmCustomCommandTypes.h"
 #include "cmExecutionStatus.h"
 #include "cmExecutionStatus.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpression.h"
 #include "cmGlobalGenerator.h"
 #include "cmGlobalGenerator.h"
@@ -214,7 +215,7 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
   // Add the utility target to the makefile.
   // Add the utility target to the makefile.
   bool escapeOldStyle = !verbatim;
   bool escapeOldStyle = !verbatim;
   cmTarget* target = mf.AddUtilityCommand(
   cmTarget* target = mf.AddUtilityCommand(
-    targetName, cmMakefile::TargetOrigin::Project, excludeFromAll,
+    targetName, cmCommandOrigin::Project, excludeFromAll,
     working_directory.c_str(), byproducts, depends, commandLines,
     working_directory.c_str(), byproducts, depends, commandLines,
     escapeOldStyle, comment, uses_terminal, command_expand_lists, job_pool);
     escapeOldStyle, comment, uses_terminal, command_expand_lists, job_pool);
 
 

+ 5 - 5
Source/cmCPluginAPI.cxx

@@ -220,7 +220,7 @@ void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
   }
   }
 
 
   // Pass the call to the makefile instance.
   // Pass the call to the makefile instance.
-  mf->AddUtilityCommand(utilityName, cmMakefile::TargetOrigin::Project,
+  mf->AddUtilityCommand(utilityName, cmCommandOrigin::Project,
                         (all ? false : true), nullptr, depends2, commandLines);
                         (all ? false : true), nullptr, depends2, commandLines);
 }
 }
 void CCONV cmAddCustomCommand(void* arg, const char* source,
 void CCONV cmAddCustomCommand(void* arg, const char* source,
@@ -319,16 +319,16 @@ void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
   commandLines.push_back(commandLine);
   commandLines.push_back(commandLine);
 
 
   // Select the command type.
   // Select the command type.
-  cmTarget::CustomCommandType cctype = cmTarget::POST_BUILD;
+  cmCustomCommandType cctype = cmCustomCommandType::POST_BUILD;
   switch (commandType) {
   switch (commandType) {
     case CM_PRE_BUILD:
     case CM_PRE_BUILD:
-      cctype = cmTarget::PRE_BUILD;
+      cctype = cmCustomCommandType::PRE_BUILD;
       break;
       break;
     case CM_PRE_LINK:
     case CM_PRE_LINK:
-      cctype = cmTarget::PRE_LINK;
+      cctype = cmCustomCommandType::PRE_LINK;
       break;
       break;
     case CM_POST_BUILD:
     case CM_POST_BUILD:
-      cctype = cmTarget::POST_BUILD;
+      cctype = cmCustomCommandType::POST_BUILD;
       break;
       break;
   }
   }
 
 

+ 30 - 0
Source/cmCustomCommandTypes.h

@@ -0,0 +1,30 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+#ifndef cmCustomCommandTypes_h
+#define cmCustomCommandTypes_h
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+/** Target custom command type */
+enum class cmCustomCommandType
+{
+  PRE_BUILD,
+  PRE_LINK,
+  POST_BUILD
+};
+
+/** Where the command originated from. */
+enum class cmCommandOrigin
+{
+  Project,
+  Generator
+};
+
+/** How to handle custom commands for object libraries */
+enum class cmObjectLibraryCommands
+{
+  Reject,
+  Accept
+};
+
+#endif

+ 6 - 6
Source/cmGlobalVisualStudio8Generator.cxx

@@ -105,8 +105,8 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
 
 
   cmCustomCommandLines noCommandLines;
   cmCustomCommandLines noCommandLines;
   cmTarget* tgt = mf->AddUtilityCommand(
   cmTarget* tgt = mf->AddUtilityCommand(
-    CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmMakefile::TargetOrigin::Generator,
-    false, no_working_directory, no_depends, noCommandLines);
+    CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmCommandOrigin::Generator, false,
+    no_working_directory, no_depends, noCommandLines);
 
 
   cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
   cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
   lg->AddGeneratorTarget(gt);
   lg->AddGeneratorTarget(gt);
@@ -152,10 +152,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
       std::vector<std::string> byproducts;
       std::vector<std::string> byproducts;
       byproducts.push_back(cm->GetGlobVerifyStamp());
       byproducts.push_back(cm->GetGlobVerifyStamp());
 
 
-      mf->AddCustomCommandToTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET, byproducts,
-                                   no_depends, verifyCommandLines,
-                                   cmTarget::PRE_BUILD, "Checking File Globs",
-                                   no_working_directory, false);
+      mf->AddCustomCommandToTarget(
+        CMAKE_CHECK_BUILD_SYSTEM_TARGET, byproducts, no_depends,
+        verifyCommandLines, cmCustomCommandType::PRE_BUILD,
+        "Checking File Globs", no_working_directory, false);
 
 
       // Ensure ZERO_CHECK always runs in Visual Studio using MSBuild,
       // Ensure ZERO_CHECK always runs in Visual Studio using MSBuild,
       // otherwise the prebuild command will not be run.
       // otherwise the prebuild command will not be run.

+ 1 - 1
Source/cmGlobalVisualStudioGenerator.cxx

@@ -193,7 +193,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
       // Use no actual command lines so that the target itself is not
       // Use no actual command lines so that the target itself is not
       // considered always out of date.
       // considered always out of date.
       cmTarget* allBuild = gen[0]->GetMakefile()->AddUtilityCommand(
       cmTarget* allBuild = gen[0]->GetMakefile()->AddUtilityCommand(
-        "ALL_BUILD", cmMakefile::TargetOrigin::Generator, true, no_working_dir,
+        "ALL_BUILD", cmCommandOrigin::Generator, true, no_working_dir,
         no_depends, no_commands, false, "Build all projects");
         no_depends, no_commands, false, "Build all projects");
 
 
       cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
       cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);

+ 7 - 7
Source/cmGlobalXCodeGenerator.cxx

@@ -501,9 +501,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
   const char* no_working_directory = nullptr;
   const char* no_working_directory = nullptr;
   std::vector<std::string> no_depends;
   std::vector<std::string> no_depends;
   cmTarget* allbuild = mf->AddUtilityCommand(
   cmTarget* allbuild = mf->AddUtilityCommand(
-    "ALL_BUILD", cmMakefile::TargetOrigin::Generator, true,
-    no_working_directory, no_depends,
-    cmMakeSingleCommandLine({ "echo", "Build all projects" }));
+    "ALL_BUILD", cmCommandOrigin::Generator, true, no_working_directory,
+    no_depends, cmMakeSingleCommandLine({ "echo", "Build all projects" }));
 
 
   cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
   cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
   root->AddGeneratorTarget(allBuildGt);
   root->AddGeneratorTarget(allBuildGt);
@@ -526,8 +525,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
       this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile);
       this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile);
     cmSystemTools::ReplaceString(file, "\\ ", " ");
     cmSystemTools::ReplaceString(file, "\\ ", " ");
     cmTarget* check = mf->AddUtilityCommand(
     cmTarget* check = mf->AddUtilityCommand(
-      CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmMakefile::TargetOrigin::Generator,
-      true, no_working_directory, no_depends,
+      CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmCommandOrigin::Generator, true,
+      no_working_directory, no_depends,
       cmMakeSingleCommandLine({ "make", "-f", file }));
       cmMakeSingleCommandLine({ "make", "-f", file }));
 
 
     cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
     cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
@@ -558,8 +557,9 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
         std::vector<std::string> no_byproducts;
         std::vector<std::string> no_byproducts;
         gen->GetMakefile()->AddCustomCommandToTarget(
         gen->GetMakefile()->AddCustomCommandToTarget(
           target->GetName(), no_byproducts, no_depends, commandLines,
           target->GetName(), no_byproducts, no_depends, commandLines,
-          cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str(), true,
-          false, "", "", false, cmMakefile::AcceptObjectLibraryCommands);
+          cmCustomCommandType::POST_BUILD, "Depend check for xcode",
+          dir.c_str(), true, false, "", "", false,
+          cmObjectLibraryCommands::Accept);
       }
       }
 
 
       if (!this->IsExcluded(target)) {
       if (!this->IsExcluded(target)) {

+ 2 - 1
Source/cmLocalGenerator.cxx

@@ -7,6 +7,7 @@
 #include "cmCustomCommand.h"
 #include "cmCustomCommand.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmCustomCommandLines.h"
 #include "cmCustomCommandLines.h"
+#include "cmCustomCommandTypes.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpressionEvaluationFile.h"
 #include "cmGeneratorExpressionEvaluationFile.h"
@@ -2356,7 +2357,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target,
           if (this->GetGlobalGenerator()->IsMultiConfig()) {
           if (this->GetGlobalGenerator()->IsMultiConfig()) {
             this->Makefile->AddCustomCommandToTarget(
             this->Makefile->AddCustomCommandToTarget(
               target->GetName(), outputs, no_deps, commandLines,
               target->GetName(), outputs, no_deps, commandLines,
-              cmTarget::PRE_BUILD, no_message, no_current_dir);
+              cmCustomCommandType::PRE_BUILD, no_message, no_current_dir);
           } else {
           } else {
             cmImplicitDependsList no_implicit_depends;
             cmImplicitDependsList no_implicit_depends;
             cmSourceFile* copy_rule = this->Makefile->AddCustomCommandToOutput(
             cmSourceFile* copy_rule = this->Makefile->AddCustomCommandToOutput(

+ 14 - 13
Source/cmMakefile.cxx

@@ -39,6 +39,7 @@
 #include "cmStateDirectory.h"
 #include "cmStateDirectory.h"
 #include "cmStateTypes.h"
 #include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmSystemTools.h"
+#include "cmTarget.h"
 #include "cmTargetLinkLibraryType.h"
 #include "cmTargetLinkLibraryType.h"
 #include "cmTest.h"
 #include "cmTest.h"
 #include "cmTestGenerator.h" // IWYU pragma: keep
 #include "cmTestGenerator.h" // IWYU pragma: keep
@@ -840,10 +841,10 @@ bool cmMakefile::ValidateCustomCommand(
 cmTarget* cmMakefile::AddCustomCommandToTarget(
 cmTarget* cmMakefile::AddCustomCommandToTarget(
   const std::string& target, const std::vector<std::string>& byproducts,
   const std::string& target, const std::vector<std::string>& byproducts,
   const std::vector<std::string>& depends,
   const std::vector<std::string>& depends,
-  const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type,
+  const cmCustomCommandLines& commandLines, cmCustomCommandType type,
   const char* comment, const char* workingDir, bool escapeOldStyle,
   const char* comment, const char* workingDir, bool escapeOldStyle,
   bool uses_terminal, const std::string& depfile, const std::string& job_pool,
   bool uses_terminal, const std::string& depfile, const std::string& job_pool,
-  bool command_expand_lists, ObjectLibraryCommands objLibraryCommands)
+  bool command_expand_lists, cmObjectLibraryCommands objLibCommands)
 {
 {
   // Find the target to which to add the custom command.
   // Find the target to which to add the custom command.
   auto ti = this->Targets.find(target);
   auto ti = this->Targets.find(target);
@@ -884,7 +885,7 @@ cmTarget* cmMakefile::AddCustomCommandToTarget(
   }
   }
 
 
   cmTarget* t = &ti->second;
   cmTarget* t = &ti->second;
-  if (objLibraryCommands == RejectObjectLibraryCommands &&
+  if (objLibCommands == cmObjectLibraryCommands::Reject &&
       t->GetType() == cmStateEnums::OBJECT_LIBRARY) {
       t->GetType() == cmStateEnums::OBJECT_LIBRARY) {
     std::ostringstream e;
     std::ostringstream e;
     e << "Target \"" << target
     e << "Target \"" << target
@@ -920,7 +921,7 @@ cmTarget* cmMakefile::AddCustomCommandToTarget(
 void cmMakefile::CommitCustomCommandToTarget(
 void cmMakefile::CommitCustomCommandToTarget(
   cmTarget* target, const std::vector<std::string>& byproducts,
   cmTarget* target, const std::vector<std::string>& byproducts,
   const std::vector<std::string>& depends,
   const std::vector<std::string>& depends,
-  const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type,
+  const cmCustomCommandLines& commandLines, cmCustomCommandType type,
   const char* comment, const char* workingDir, bool escapeOldStyle,
   const char* comment, const char* workingDir, bool escapeOldStyle,
   bool uses_terminal, const std::string& depfile, const std::string& job_pool,
   bool uses_terminal, const std::string& depfile, const std::string& job_pool,
   bool command_expand_lists)
   bool command_expand_lists)
@@ -936,13 +937,13 @@ void cmMakefile::CommitCustomCommandToTarget(
   cc.SetDepfile(depfile);
   cc.SetDepfile(depfile);
   cc.SetJobPool(job_pool);
   cc.SetJobPool(job_pool);
   switch (type) {
   switch (type) {
-    case cmTarget::PRE_BUILD:
+    case cmCustomCommandType::PRE_BUILD:
       target->AddPreBuildCommand(cc);
       target->AddPreBuildCommand(cc);
       break;
       break;
-    case cmTarget::PRE_LINK:
+    case cmCustomCommandType::PRE_LINK:
       target->AddPreLinkCommand(cc);
       target->AddPreLinkCommand(cc);
       break;
       break;
-    case cmTarget::POST_BUILD:
+    case cmCustomCommandType::POST_BUILD:
       target->AddPostBuildCommand(cc);
       target->AddPostBuildCommand(cc);
       break;
       break;
   }
   }
@@ -1157,9 +1158,9 @@ void cmMakefile::AddCustomCommandOldStyle(
     // same then it added a post-build rule to the target.  Preserve
     // same then it added a post-build rule to the target.  Preserve
     // this behavior.
     // this behavior.
     std::vector<std::string> no_byproducts;
     std::vector<std::string> no_byproducts;
-    this->AddCustomCommandToTarget(target, no_byproducts, depends,
-                                   commandLines, cmTarget::POST_BUILD, comment,
-                                   nullptr);
+    this->AddCustomCommandToTarget(
+      target, no_byproducts, depends, commandLines,
+      cmCustomCommandType::POST_BUILD, comment, nullptr);
     return;
     return;
   }
   }
 
 
@@ -1248,7 +1249,7 @@ void cmMakefile::CommitAppendCustomCommandToOutput(
 }
 }
 
 
 cmTarget* cmMakefile::AddUtilityCommand(
 cmTarget* cmMakefile::AddUtilityCommand(
-  const std::string& utilityName, TargetOrigin origin, bool excludeFromAll,
+  const std::string& utilityName, cmCommandOrigin origin, bool excludeFromAll,
   const char* workingDirectory, const std::vector<std::string>& depends,
   const char* workingDirectory, const std::vector<std::string>& depends,
   const cmCustomCommandLines& commandLines, bool escapeOldStyle,
   const cmCustomCommandLines& commandLines, bool escapeOldStyle,
   const char* comment, bool uses_terminal, bool command_expand_lists,
   const char* comment, bool uses_terminal, bool command_expand_lists,
@@ -1262,7 +1263,7 @@ cmTarget* cmMakefile::AddUtilityCommand(
 }
 }
 
 
 cmTarget* cmMakefile::AddUtilityCommand(
 cmTarget* cmMakefile::AddUtilityCommand(
-  const std::string& utilityName, TargetOrigin origin, bool excludeFromAll,
+  const std::string& utilityName, cmCommandOrigin origin, bool excludeFromAll,
   const char* workingDirectory, const std::vector<std::string>& byproducts,
   const char* workingDirectory, const std::vector<std::string>& byproducts,
   const std::vector<std::string>& depends,
   const std::vector<std::string>& depends,
   const cmCustomCommandLines& commandLines, bool escapeOldStyle,
   const cmCustomCommandLines& commandLines, bool escapeOldStyle,
@@ -1271,7 +1272,7 @@ cmTarget* cmMakefile::AddUtilityCommand(
 {
 {
   // Create a target instance for this utility.
   // Create a target instance for this utility.
   cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName);
   cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName);
-  target->SetIsGeneratorProvided(origin == TargetOrigin::Generator);
+  target->SetIsGeneratorProvided(origin == cmCommandOrigin::Generator);
   if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
   if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
     target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
     target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
   }
   }

+ 14 - 22
Source/cmMakefile.h

@@ -20,6 +20,7 @@
 #include <cm/string_view>
 #include <cm/string_view>
 
 
 #include "cmAlgorithms.h"
 #include "cmAlgorithms.h"
+#include "cmCustomCommandTypes.h"
 #include "cmListFileCache.h"
 #include "cmListFileCache.h"
 #include "cmMessageType.h"
 #include "cmMessageType.h"
 #include "cmNewLineStyle.h"
 #include "cmNewLineStyle.h"
@@ -28,7 +29,10 @@
 #include "cmStateSnapshot.h"
 #include "cmStateSnapshot.h"
 #include "cmStateTypes.h"
 #include "cmStateTypes.h"
 #include "cmStringAlgorithms.h"
 #include "cmStringAlgorithms.h"
-#include "cmTarget.h"
+
+// IWYU does not see that 'std::unordered_map<std::string, cmTarget>'
+// will not compile without the complete type.
+#include "cmTarget.h" // IWYU pragma: keep
 
 
 #if !defined(CMAKE_BOOTSTRAP)
 #if !defined(CMAKE_BOOTSTRAP)
 #  include "cmSourceGroup.h"
 #  include "cmSourceGroup.h"
@@ -164,22 +168,15 @@ public:
    */
    */
   void FinalPass();
   void FinalPass();
 
 
-  /** How to handle custom commands for object libraries */
-  enum ObjectLibraryCommands
-  {
-    RejectObjectLibraryCommands,
-    AcceptObjectLibraryCommands
-  };
-
   /** Add a custom command to the build.  */
   /** Add a custom command to the build.  */
   cmTarget* AddCustomCommandToTarget(
   cmTarget* AddCustomCommandToTarget(
     const std::string& target, const std::vector<std::string>& byproducts,
     const std::string& target, const std::vector<std::string>& byproducts,
     const std::vector<std::string>& depends,
     const std::vector<std::string>& depends,
-    const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type,
+    const cmCustomCommandLines& commandLines, cmCustomCommandType type,
     const char* comment, const char* workingDir, bool escapeOldStyle = true,
     const char* comment, const char* workingDir, bool escapeOldStyle = true,
     bool uses_terminal = false, const std::string& depfile = "",
     bool uses_terminal = false, const std::string& depfile = "",
     const std::string& job_pool = "", bool command_expand_lists = false,
     const std::string& job_pool = "", bool command_expand_lists = false,
-    ObjectLibraryCommands objLibraryCommands = RejectObjectLibraryCommands);
+    cmObjectLibraryCommands objLibCommands = cmObjectLibraryCommands::Reject);
   cmSourceFile* AddCustomCommandToOutput(
   cmSourceFile* AddCustomCommandToOutput(
     const std::string& output, const std::vector<std::string>& depends,
     const std::string& output, const std::vector<std::string>& depends,
     const std::string& main_dependency,
     const std::string& main_dependency,
@@ -232,26 +229,21 @@ public:
                           const std::vector<std::string>& srcs,
                           const std::vector<std::string>& srcs,
                           bool excludeFromAll = false);
                           bool excludeFromAll = false);
 
 
-  /** Where the target originated from. */
-  enum class TargetOrigin
-  {
-    Project,
-    Generator
-  };
-
   /**
   /**
    * Add a utility to the build.  A utility target is a command that
    * Add a utility to the build.  A utility target is a command that
    * is run every time the target is built.
    * is run every time the target is built.
    */
    */
   cmTarget* AddUtilityCommand(
   cmTarget* AddUtilityCommand(
-    const std::string& utilityName, TargetOrigin origin, bool excludeFromAll,
-    const char* workingDirectory, const std::vector<std::string>& depends,
+    const std::string& utilityName, cmCommandOrigin origin,
+    bool excludeFromAll, const char* workingDirectory,
+    const std::vector<std::string>& depends,
     const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
     const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
     const char* comment = nullptr, bool uses_terminal = false,
     const char* comment = nullptr, bool uses_terminal = false,
     bool command_expand_lists = false, const std::string& job_pool = "");
     bool command_expand_lists = false, const std::string& job_pool = "");
   cmTarget* AddUtilityCommand(
   cmTarget* AddUtilityCommand(
-    const std::string& utilityName, TargetOrigin origin, bool excludeFromAll,
-    const char* workingDirectory, const std::vector<std::string>& byproducts,
+    const std::string& utilityName, cmCommandOrigin origin,
+    bool excludeFromAll, const char* workingDirectory,
+    const std::vector<std::string>& byproducts,
     const std::vector<std::string>& depends,
     const std::vector<std::string>& depends,
     const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
     const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
     const char* comment = nullptr, bool uses_terminal = false,
     const char* comment = nullptr, bool uses_terminal = false,
@@ -1064,7 +1056,7 @@ private:
   void CommitCustomCommandToTarget(
   void CommitCustomCommandToTarget(
     cmTarget* target, const std::vector<std::string>& byproducts,
     cmTarget* target, const std::vector<std::string>& byproducts,
     const std::vector<std::string>& depends,
     const std::vector<std::string>& depends,
-    const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type,
+    const cmCustomCommandLines& commandLines, cmCustomCommandType type,
     const char* comment, const char* workingDir, bool escapeOldStyle,
     const char* comment, const char* workingDir, bool escapeOldStyle,
     bool uses_terminal, const std::string& depfile,
     bool uses_terminal, const std::string& depfile,
     const std::string& job_pool, bool command_expand_lists);
     const std::string& job_pool, bool command_expand_lists);

+ 2 - 1
Source/cmQtAutoGenGlobalInitializer.cxx

@@ -3,6 +3,7 @@
 #include "cmQtAutoGenGlobalInitializer.h"
 #include "cmQtAutoGenGlobalInitializer.h"
 
 
 #include "cmCustomCommandLines.h"
 #include "cmCustomCommandLines.h"
+#include "cmCustomCommandTypes.h"
 #include "cmDuration.h"
 #include "cmDuration.h"
 #include "cmGeneratorTarget.h"
 #include "cmGeneratorTarget.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalGenerator.h"
@@ -154,7 +155,7 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget(
 
 
     // Create utility target
     // Create utility target
     cmTarget* target = makefile->AddUtilityCommand(
     cmTarget* target = makefile->AddUtilityCommand(
-      name, cmMakefile::TargetOrigin::Generator, true,
+      name, cmCommandOrigin::Generator, true,
       makefile->GetHomeOutputDirectory().c_str() /*work dir*/,
       makefile->GetHomeOutputDirectory().c_str() /*work dir*/,
       std::vector<std::string>() /*output*/,
       std::vector<std::string>() /*output*/,
       std::vector<std::string>() /*depends*/, cmCustomCommandLines(), false,
       std::vector<std::string>() /*depends*/, cmCustomCommandLines(), false,

+ 4 - 4
Source/cmQtAutoGenInitializer.cxx

@@ -8,6 +8,7 @@
 #include "cmAlgorithms.h"
 #include "cmAlgorithms.h"
 #include "cmCustomCommand.h"
 #include "cmCustomCommand.h"
 #include "cmCustomCommandLines.h"
 #include "cmCustomCommandLines.h"
+#include "cmCustomCommandTypes.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorTarget.h"
 #include "cmGeneratorTarget.h"
@@ -1117,7 +1118,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
 
 
     // Create autogen target
     // Create autogen target
     cmTarget* autogenTarget = this->Makefile->AddUtilityCommand(
     cmTarget* autogenTarget = this->Makefile->AddUtilityCommand(
-      this->AutogenTarget.Name, cmMakefile::TargetOrigin::Generator, true,
+      this->AutogenTarget.Name, cmCommandOrigin::Generator, true,
       this->Dir.Work.c_str(), /*byproducts=*/autogenProvides,
       this->Dir.Work.c_str(), /*byproducts=*/autogenProvides,
       std::vector<std::string>(this->AutogenTarget.DependFiles.begin(),
       std::vector<std::string>(this->AutogenTarget.DependFiles.begin(),
                                this->AutogenTarget.DependFiles.end()),
                                this->AutogenTarget.DependFiles.end()),
@@ -1199,9 +1200,8 @@ bool cmQtAutoGenInitializer::InitRccTargets()
         }
         }
 
 
         cmTarget* autoRccTarget = this->Makefile->AddUtilityCommand(
         cmTarget* autoRccTarget = this->Makefile->AddUtilityCommand(
-          ccName, cmMakefile::TargetOrigin::Generator, true,
-          this->Dir.Work.c_str(), ccOutput, ccDepends, commandLines, false,
-          ccComment.c_str());
+          ccName, cmCommandOrigin::Generator, true, this->Dir.Work.c_str(),
+          ccOutput, ccDepends, commandLines, false, ccComment.c_str());
 
 
         // Create autogen generator target
         // Create autogen generator target
         this->LocalGen->AddGeneratorTarget(
         this->LocalGen->AddGeneratorTarget(

+ 0 - 7
Source/cmTarget.h

@@ -43,13 +43,6 @@ public:
     VisibilityImportedGlobally
     VisibilityImportedGlobally
   };
   };
 
 
-  enum CustomCommandType
-  {
-    PRE_BUILD,
-    PRE_LINK,
-    POST_BUILD
-  };
-
   cmTarget(std::string const& name, cmStateEnums::TargetType type,
   cmTarget(std::string const& name, cmStateEnums::TargetType type,
            Visibility vis, cmMakefile* mf);
            Visibility vis, cmMakefile* mf);