From e37511ae7eb68a46fb9edb9f00d3fc179f713e45 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 14 Nov 2021 17:22:33 +0900 Subject: 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. --- Source/cmMakefile.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Source/cmMakefile.h') 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; + using CCActionT = + std::function cc)>; public: GeneratorAction(ActionT&& action) @@ -151,10 +154,20 @@ public: { } + GeneratorAction(std::unique_ptr 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 cc; }; /** -- cgit v1.2.1