summaryrefslogtreecommitdiff
path: root/Source/cmAddCustomCommandCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-05-14 11:38:47 -0400
committerBrad King <brad.king@kitware.com>2008-05-14 11:38:47 -0400
commit600e5e274ea5e78989c9355685e97d6f4d6f28ec (patch)
treed101d1d699fbbdb3a2e36a581228cd0c56d2b72a /Source/cmAddCustomCommandCommand.cxx
parent3fb5602e547b4ae23ae9bdcc36be09bbc5f6fbea (diff)
downloadcmake-600e5e274ea5e78989c9355685e97d6f4d6f28ec.tar.gz
ENH: Add SKIP_RULE_DEPENDS option for add_custom_command()
- Allows make rules to be created with no dependencies. - Such rules will not re-run even if the commands themselves change. - Useful to create rules that run only if the output is missing.
Diffstat (limited to 'Source/cmAddCustomCommandCommand.cxx')
-rw-r--r--Source/cmAddCustomCommandCommand.cxx21
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 5912a79f0e..afbdc70c4f 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -40,6 +40,7 @@ bool cmAddCustomCommandCommand
std::vector<std::string> depends, outputs, output;
bool verbatim = false;
bool append = false;
+ bool skip_rule_depends = false;
std::string implicit_depends_lang;
cmCustomCommand::ImplicitDependsList implicit_depends;
@@ -103,6 +104,11 @@ bool cmAddCustomCommandCommand
{
verbatim = true;
}
+ else if(copy == "SKIP_RULE_DEPENDS")
+ {
+ doing = doing_nothing;
+ skip_rule_depends = true;
+ }
else if(copy == "APPEND")
{
append = true;
@@ -310,8 +316,8 @@ bool cmAddCustomCommandCommand
working.c_str(), false,
escapeOldStyle);
- // Add implicit dependency scanning requests if any were given.
- if(!implicit_depends.empty())
+ // Get the rule object to add some extra information.
+ if(!implicit_depends.empty() || skip_rule_depends)
{
bool okay = false;
if(cmSourceFile* sf =
@@ -320,7 +326,16 @@ bool cmAddCustomCommandCommand
if(cmCustomCommand* cc = sf->GetCustomCommand())
{
okay = true;
- cc->SetImplicitDepends(implicit_depends);
+
+ // Add implicit dependency scanning requests if any were
+ // given.
+ if(!implicit_depends.empty())
+ {
+ cc->SetImplicitDepends(implicit_depends);
+ }
+
+ // Set the rule dependency state.
+ cc->SetSkipRuleDepends(skip_rule_depends);
}
}
if(!okay)