diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2021-11-14 17:22:33 +0900 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-11-18 12:02:37 -0500 |
commit | e37511ae7eb68a46fb9edb9f00d3fc179f713e45 (patch) | |
tree | 98bde246d5424c4552bb1b0149f96449d948bd86 /Source/cmMakefile.h | |
parent | 90e1206f253c0acbef37668403133585a31b2a92 (diff) | |
download | cmake-e37511ae7eb68a46fb9edb9f00d3fc179f713e45.tar.gz |
cmMakefile: Simplify detail:::Add{Custom,Utility}Command
Note 1: `detail::AddCustomCommandToTarget()` resets cc,
since cc is not moved away.
Note 2: In `detail::AddUtilityCommand()`, a few vars are preserved
before using. Their refs will be alive in most cases, but cc might
be destroyed in the future.
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r-- | Source/cmMakefile.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 75412d77ca..82c17a110e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -24,6 +24,7 @@ #include "cm_sys_stat.h" #include "cmAlgorithms.h" +#include "cmCustomCommand.h" #include "cmCustomCommandTypes.h" #include "cmListFileCache.h" #include "cmMessageType.h" @@ -50,7 +51,6 @@ class cmExportBuildFileGenerator; class cmFunctionBlocker; class cmGeneratorExpressionEvaluationFile; class cmGlobalGenerator; -class cmImplicitDependsList; class cmInstallGenerator; class cmLocalGenerator; class cmMessenger; @@ -144,6 +144,9 @@ public: { using ActionT = std::function<void(cmLocalGenerator&, const cmListFileBacktrace&)>; + using CCActionT = + std::function<void(cmLocalGenerator&, const cmListFileBacktrace&, + std::unique_ptr<cmCustomCommand> cc)>; public: GeneratorAction(ActionT&& action) @@ -151,10 +154,20 @@ public: { } + GeneratorAction(std::unique_ptr<cmCustomCommand> tcc, CCActionT&& action) + : CCAction(std::move(action)) + , cc(std::move(tcc)) + { + } + void operator()(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt); private: ActionT Action; + + // FIXME: Use std::variant + CCActionT CCAction; + std::unique_ptr<cmCustomCommand> cc; }; /** |