diff options
author | Daniel Eiband <daniel.eiband@brainlab.com> | 2019-09-20 22:55:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-26 14:03:48 (GMT) |
commit | ea1bed34b2ba16f3971b90996dc345834f0d9699 (patch) | |
tree | cfcb9a2911b889f4b8831e5ff1f666d6679d1ae2 /Source/cmMakefile.h | |
parent | 91abf9f3c4a80f5a8417401d5277b3b66bc7d008 (diff) | |
download | CMake-ea1bed34b2ba16f3971b90996dc345834f0d9699.zip CMake-ea1bed34b2ba16f3971b90996dc345834f0d9699.tar.gz CMake-ea1bed34b2ba16f3971b90996dc345834f0d9699.tar.bz2 |
cmMakefile: Extract utilities used for creation of custom commands
Decompose creation of custom commands further into logical steps.
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r-- | Source/cmMakefile.h | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 6bac47c..5ea2cce 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -168,6 +168,12 @@ public: */ void FinalPass(); + /** + * Get the target for PRE_BUILD, PRE_LINK, or POST_BUILD commands. + */ + cmTarget* GetCustomCommandTarget( + const std::string& target, cmObjectLibraryCommands objLibCommands) const; + /** Add a custom command to the build. */ cmTarget* AddCustomCommandToTarget( const std::string& target, const std::vector<std::string>& byproducts, @@ -206,6 +212,19 @@ public: const cmCustomCommandLines& commandLines); /** + * Add target byproducts. + */ + void AddTargetByproducts(cmTarget* target, + const std::vector<std::string>& byproducts); + + /** + * Add source file outputs. + */ + void AddSourceOutputs(cmSourceFile* source, + const std::vector<std::string>& outputs, + const std::vector<std::string>& byproducts); + + /** * Add a define flag to the build. */ void AddDefineFlag(std::string const& definition); @@ -222,6 +241,10 @@ public: cmTarget* AddNewTarget(cmStateEnums::TargetType type, const std::string& name); + /** Create a target instance for the utility. */ + cmTarget* AddNewUtilityTarget(const std::string& utilityName, + cmCommandOrigin origin, bool excludeFromAll); + /** * Add an executable to the build. */ @@ -230,6 +253,11 @@ public: bool excludeFromAll = false); /** + * Return the utility target output source file name and the CMP0049 name. + */ + cmUtilityOutput GetUtilityOutput(cmTarget* target); + + /** * Add a utility to the build. A utility target is a command that * is run every time the target is built. */ @@ -447,6 +475,12 @@ public: const std::string& sourceName, bool generated = false, cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous); + /** Get a cmSourceFile pointer for a given source name and always mark the + * file as generated, if the name is not found, then create the source file + * and return it. + */ + cmSourceFile* GetOrCreateGeneratedSource(const std::string& sourceName); + void AddTargetObject(std::string const& tgtName, std::string const& objFile); /** @@ -1028,13 +1062,12 @@ private: friend bool cmCMakePolicyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); class IncludeScope; - friend class IncludeScope; - class ListFileScope; + class ListFileScope; friend class ListFileScope; - class BuildsystemFileScope; + class BuildsystemFileScope; friend class BuildsystemFileScope; // CMP0053 == old @@ -1053,6 +1086,8 @@ private: bool ValidateCustomCommand(const cmCustomCommandLines& commandLines) const; + void CreateGeneratedSources(const std::vector<std::string>& outputs); + void CommitCustomCommandToTarget( cmTarget* target, const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, @@ -1075,8 +1110,7 @@ private: const cmImplicitDependsList& implicit_depends, const cmCustomCommandLines& commandLines); - void CommitUtilityCommand(cmTarget* target, const std::string& force, - const std::string& forceCMP0049, + void CommitUtilityCommand(cmTarget* target, const cmUtilityOutput& force, const char* workingDirectory, const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, @@ -1085,9 +1119,6 @@ private: bool uses_terminal, bool command_expand_lists, const std::string& job_pool); - void CreateGeneratedSource(const std::string& output); - void CreateGeneratedSources(const std::vector<std::string>& outputs); - /** * See LinearGetSourceFileWithOutput for background information */ @@ -1112,12 +1143,7 @@ private: using OutputToSourceMap = std::unordered_map<std::string, SourceEntry>; OutputToSourceMap OutputToSource; - void UpdateOutputToSourceMap(std::vector<std::string> const& byproducts, - cmTarget* target); void UpdateOutputToSourceMap(std::string const& byproduct, cmTarget* target); - - void UpdateOutputToSourceMap(std::vector<std::string> const& outputs, - cmSourceFile* source, bool byproduct); void UpdateOutputToSourceMap(std::string const& output, cmSourceFile* source, bool byproduct); |