From db182eb160f2e61bebeb1bb5f289a6d899da18da Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sat, 23 Mar 2019 16:57:16 +0100 Subject: [PATCH] cmTarget: Move member `*Commands` to impl --- Source/cmGlobalVisualStudioGenerator.cxx | 1 + Source/cmGlobalXCodeGenerator.cxx | 1 + Source/cmLocalUnixMakefileGenerator3.cxx | 1 + Source/cmLocalVisualStudio7Generator.cxx | 1 + Source/cmLocalVisualStudioGenerator.cxx | 1 + Source/cmNinjaNormalTargetGenerator.cxx | 3 +- Source/cmTarget.cxx | 34 +++++++++++++++++ Source/cmTarget.h | 43 ++++++---------------- Source/cmVisualStudio10TargetGenerator.cxx | 1 + 9 files changed, 53 insertions(+), 33 deletions(-) diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index bc40a5c72d..280c9864a2 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/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" diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4025073a5b..ad1a636855 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/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" diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f3d5a9429e..f6ee9fc310 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -11,6 +11,7 @@ #include #include "cmAlgorithms.h" +#include "cmCustomCommand.h" // IWYU pragma: keep #include "cmCustomCommandGenerator.h" #include "cmFileTimeCache.h" #include "cmGeneratedFileStream.h" diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a497308320..e519d78ec5 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/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" diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 660729c3ac..f3f2042ec3 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/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" diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b38d41070f..3300fef971 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -12,6 +12,7 @@ #include #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) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 208655c46e..91023ee5fe 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -13,6 +13,7 @@ #include #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> Utilities; + std::vector PreBuildCommands; + std::vector PreLinkCommands; + std::vector PostBuildCommands; std::set SystemIncludeDirectories; cmTarget::LinkLibraryVectorType OriginalLinkLibraries; std::vector IncludeDirectoriesEntries; @@ -550,6 +554,36 @@ bool cmTarget::IsAppBundleOnApple() const this->GetPropertyAsBool("MACOSX_BUNDLE")); } +std::vector const& cmTarget::GetPreBuildCommands() const +{ + return impl->PreBuildCommands; +} + +void cmTarget::AddPreBuildCommand(cmCustomCommand const& cmd) +{ + impl->PreBuildCommands.push_back(cmd); +} + +std::vector const& cmTarget::GetPreLinkCommands() const +{ + return impl->PreLinkCommands; +} + +void cmTarget::AddPreLinkCommand(cmCustomCommand const& cmd) +{ + impl->PreLinkCommands.push_back(cmd); +} + +std::vector const& cmTarget::GetPostBuildCommands() const +{ + return impl->PostBuildCommands; +} + +void cmTarget::AddPostBuildCommand(cmCustomCommand const& cmd) +{ + impl->PostBuildCommands.push_back(cmd); +} + void cmTarget::AddTracedSources(std::vector const& srcs) { if (!srcs.empty()) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index b441df1f07..297f5019f9 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -13,12 +13,12 @@ #include #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 const& GetPreBuildCommands() const - { - return this->PreBuildCommands; - } - std::vector const& GetPreLinkCommands() const - { - return this->PreLinkCommands; - } - std::vector 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 const& GetPreBuildCommands() const; + void AddPreBuildCommand(cmCustomCommand const& cmd); + + ///! Get the list of the PRE_LINK custom commands for this target + std::vector const& GetPreLinkCommands() const; + void AddPreLinkCommand(cmCustomCommand const& cmd); + + ///! Get the list of the POST_BUILD custom commands for this target + std::vector const& GetPostBuildCommands() const; + void AddPostBuildCommand(cmCustomCommand const& cmd); ///! Add sources to the target. void AddSources(std::vector const& srcs); @@ -291,9 +275,6 @@ private: private: bool IsGeneratorProvided; - std::vector PreBuildCommands; - std::vector PreLinkCommands; - std::vector PostBuildCommands; cmTargetInternalPointer impl; bool HaveInstallRule; bool DLLPlatform; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5c9f25e2c2..8804e6c960 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/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"