Browse Source

cmTarget: Move member `*Commands` to impl

Sebastian Holtermann 6 năm trước cách đây
mục cha
commit
db182eb160

+ 1 - 0
Source/cmGlobalVisualStudioGenerator.cxx

@@ -12,6 +12,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmCallVisualStudioMacro.h"
+#include "cmCustomCommand.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmLocalVisualStudioGenerator.h"

+ 1 - 0
Source/cmGlobalXCodeGenerator.cxx

@@ -12,6 +12,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmComputeLinkInformation.h"
+#include "cmCustomCommand.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmDocumentationEntry.h"
 #include "cmGeneratedFileStream.h"

+ 1 - 0
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -11,6 +11,7 @@
 #include <utility>
 
 #include "cmAlgorithms.h"
+#include "cmCustomCommand.h" // IWYU pragma: keep
 #include "cmCustomCommandGenerator.h"
 #include "cmFileTimeCache.h"
 #include "cmGeneratedFileStream.h"

+ 1 - 0
Source/cmLocalVisualStudio7Generator.cxx

@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmLocalVisualStudio7Generator.h"
 
+#include "cmCustomCommand.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalVisualStudio7Generator.h"

+ 1 - 0
Source/cmLocalVisualStudioGenerator.cxx

@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmLocalVisualStudioGenerator.h"
 
+#include "cmCustomCommand.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"

+ 1 - 2
Source/cmNinjaNormalTargetGenerator.cxx

@@ -12,6 +12,7 @@
 #include <utility>
 
 #include "cmAlgorithms.h"
+#include "cmCustomCommand.h" // IWYU pragma: keep
 #include "cmCustomCommandGenerator.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
@@ -32,8 +33,6 @@
 #include "cmStateTypes.h"
 #include "cmSystemTools.h"
 
-class cmCustomCommand;
-
 cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
   cmGeneratorTarget* target)
   : cmNinjaTargetGenerator(target)

+ 34 - 0
Source/cmTarget.cxx

@@ -13,6 +13,7 @@
 #include <unordered_set>
 
 #include "cmAlgorithms.h"
+#include "cmCustomCommand.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
@@ -173,6 +174,9 @@ public:
   std::string RuntimeInstallPath;
   cmPropertyMap Properties;
   std::set<BT<std::string>> Utilities;
+  std::vector<cmCustomCommand> PreBuildCommands;
+  std::vector<cmCustomCommand> PreLinkCommands;
+  std::vector<cmCustomCommand> PostBuildCommands;
   std::set<std::string> SystemIncludeDirectories;
   cmTarget::LinkLibraryVectorType OriginalLinkLibraries;
   std::vector<std::string> IncludeDirectoriesEntries;
@@ -550,6 +554,36 @@ bool cmTarget::IsAppBundleOnApple() const
           this->GetPropertyAsBool("MACOSX_BUNDLE"));
 }
 
+std::vector<cmCustomCommand> const& cmTarget::GetPreBuildCommands() const
+{
+  return impl->PreBuildCommands;
+}
+
+void cmTarget::AddPreBuildCommand(cmCustomCommand const& cmd)
+{
+  impl->PreBuildCommands.push_back(cmd);
+}
+
+std::vector<cmCustomCommand> const& cmTarget::GetPreLinkCommands() const
+{
+  return impl->PreLinkCommands;
+}
+
+void cmTarget::AddPreLinkCommand(cmCustomCommand const& cmd)
+{
+  impl->PreLinkCommands.push_back(cmd);
+}
+
+std::vector<cmCustomCommand> const& cmTarget::GetPostBuildCommands() const
+{
+  return impl->PostBuildCommands;
+}
+
+void cmTarget::AddPostBuildCommand(cmCustomCommand const& cmd)
+{
+  impl->PostBuildCommands.push_back(cmd);
+}
+
 void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
 {
   if (!srcs.empty()) {

+ 12 - 31
Source/cmTarget.h

@@ -13,12 +13,12 @@
 #include <vector>
 
 #include "cmAlgorithms.h"
-#include "cmCustomCommand.h"
 #include "cmListFileCache.h"
 #include "cmPolicies.h"
 #include "cmStateTypes.h"
 #include "cmTargetLinkLibraryType.h"
 
+class cmCustomCommand;
 class cmGlobalGenerator;
 class cmMakefile;
 class cmMessenger;
@@ -94,33 +94,17 @@ public:
 
 #undef DECLARE_TARGET_POLICY
 
-  /**
-   * Get the list of the custom commands for this target
-   */
-  std::vector<cmCustomCommand> const& GetPreBuildCommands() const
-  {
-    return this->PreBuildCommands;
-  }
-  std::vector<cmCustomCommand> const& GetPreLinkCommands() const
-  {
-    return this->PreLinkCommands;
-  }
-  std::vector<cmCustomCommand> const& GetPostBuildCommands() const
-  {
-    return this->PostBuildCommands;
-  }
-  void AddPreBuildCommand(cmCustomCommand const& cmd)
-  {
-    this->PreBuildCommands.push_back(cmd);
-  }
-  void AddPreLinkCommand(cmCustomCommand const& cmd)
-  {
-    this->PreLinkCommands.push_back(cmd);
-  }
-  void AddPostBuildCommand(cmCustomCommand const& cmd)
-  {
-    this->PostBuildCommands.push_back(cmd);
-  }
+  ///! Get the list of the PRE_BUILD custom commands for this target
+  std::vector<cmCustomCommand> const& GetPreBuildCommands() const;
+  void AddPreBuildCommand(cmCustomCommand const& cmd);
+
+  ///! Get the list of the PRE_LINK custom commands for this target
+  std::vector<cmCustomCommand> const& GetPreLinkCommands() const;
+  void AddPreLinkCommand(cmCustomCommand const& cmd);
+
+  ///! Get the list of the POST_BUILD custom commands for this target
+  std::vector<cmCustomCommand> const& GetPostBuildCommands() const;
+  void AddPostBuildCommand(cmCustomCommand const& cmd);
 
   ///! Add sources to the target.
   void AddSources(std::vector<std::string> const& srcs);
@@ -291,9 +275,6 @@ private:
 
 private:
   bool IsGeneratorProvided;
-  std::vector<cmCustomCommand> PreBuildCommands;
-  std::vector<cmCustomCommand> PreLinkCommands;
-  std::vector<cmCustomCommand> PostBuildCommands;
   cmTargetInternalPointer impl;
   bool HaveInstallRule;
   bool DLLPlatform;

+ 1 - 0
Source/cmVisualStudio10TargetGenerator.cxx

@@ -4,6 +4,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmComputeLinkInformation.h"
+#include "cmCustomCommand.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorExpression.h"