diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2002-04-11 14:05:47 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2002-04-11 14:05:47 (GMT) |
commit | 9b8926925b2c50afff276d25a5ee6eadd31ec477 (patch) | |
tree | fc5dda815f4e6a00d8dfe3ada5aa6f6bfe1c4b25 /Source/cmAddCustomCommandCommand.cxx | |
parent | e455a83969be5ff4642a9c505f2f1c23248b01f7 (diff) | |
download | CMake-9b8926925b2c50afff276d25a5ee6eadd31ec477.zip CMake-9b8926925b2c50afff276d25a5ee6eadd31ec477.tar.gz CMake-9b8926925b2c50afff276d25a5ee6eadd31ec477.tar.bz2 |
ENH: use target as source if source is empty
Diffstat (limited to 'Source/cmAddCustomCommandCommand.cxx')
-rw-r--r-- | Source/cmAddCustomCommandCommand.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 845ff24..f601ecc 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -21,10 +21,10 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& argsIn) { /* Let's complain at the end of this function about the lack of a particular - arg. For the moment, let's say that SOURCE, COMMAND, TARGET are always + arg. For the moment, let's say that COMMAND, TARGET are always required. */ - if (argsIn.size() < 6) + if (argsIn.size() < 4) { this->SetError("called with wrong number of arguments."); return false; @@ -106,15 +106,10 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args } /* At this point we could complain about the lack of arguments. - For the moment, let's say that SOURCE, COMMAND, TARGET are always + For the moment, let's say that COMMAND, TARGET are always required. */ - if(source.empty()) - { - this->SetError("Wrong syntax. Empty SOURCE."); - return false; - } if(command.empty()) { this->SetError("Wrong syntax. Empty COMMAND."); @@ -125,6 +120,15 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args this->SetError("Wrong syntax. Empty TARGET."); return false; } + + // If source is empty, use target as source, so that this command + // can be used to just attach a commmand to a target + + if(source.empty()) + { + source = target; + } + m_Makefile->AddCustomCommand(source.c_str(), command.c_str(), command_args, |