summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.h
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2021-11-14 08:22:33 (GMT)
committerBrad King <brad.king@kitware.com>2021-11-18 17:02:37 (GMT)
commite37511ae7eb68a46fb9edb9f00d3fc179f713e45 (patch)
tree98bde246d5424c4552bb1b0149f96449d948bd86 /Source/cmMakefile.h
parent90e1206f253c0acbef37668403133585a31b2a92 (diff)
downloadCMake-e37511ae7eb68a46fb9edb9f00d3fc179f713e45.zip
CMake-e37511ae7eb68a46fb9edb9f00d3fc179f713e45.tar.gz
CMake-e37511ae7eb68a46fb9edb9f00d3fc179f713e45.tar.bz2
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.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 75412d7..82c17a1 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;
};
/**