diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2021-11-14 01:19:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-11-18 17:02:37 (GMT) |
commit | 90e1206f253c0acbef37668403133585a31b2a92 (patch) | |
tree | 16a2265d0bf1032f9720adc350e865655efffa5d /Source/cmMakefile.h | |
parent | 9b31a977481ea07c979549246ee46946e9978e08 (diff) | |
download | CMake-90e1206f253c0acbef37668403133585a31b2a92.zip CMake-90e1206f253c0acbef37668403133585a31b2a92.tar.gz CMake-90e1206f253c0acbef37668403133585a31b2a92.tar.bz2 |
cmMakefile: Introduce GeneratorAction as the class.
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r-- | Source/cmMakefile.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c29fb00..75412d7 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -140,13 +140,34 @@ public: bool EnforceUniqueName(std::string const& name, std::string& msg, bool isCustom = false) const; - using GeneratorAction = - std::function<void(cmLocalGenerator&, const cmListFileBacktrace&)>; + class GeneratorAction + { + using ActionT = + std::function<void(cmLocalGenerator&, const cmListFileBacktrace&)>; + + public: + GeneratorAction(ActionT&& action) + : Action(std::move(action)) + { + } + + void operator()(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt); + + private: + ActionT Action; + }; /** * Register an action that is executed during Generate */ - void AddGeneratorAction(GeneratorAction action); + void AddGeneratorAction(GeneratorAction&& action); + + /// Helper to insert the constructor GeneratorAction(args...) + template <class... Args> + void AddGeneratorAction(Args&&... args) + { + AddGeneratorAction(GeneratorAction(std::move(args)...)); + } /** * Perform generate actions, Library dependency analysis etc before output of |