diff options
author | Brad King <brad.king@kitware.com> | 2008-05-14 11:38:47 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-05-14 11:38:47 -0400 |
commit | 600e5e274ea5e78989c9355685e97d6f4d6f28ec (patch) | |
tree | d101d1d699fbbdb3a2e36a581228cd0c56d2b72a /Source/cmAddCustomCommandCommand.cxx | |
parent | 3fb5602e547b4ae23ae9bdcc36be09bbc5f6fbea (diff) | |
download | cmake-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.cxx | 21 |
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) |