diff options
author | Brad King <brad.king@kitware.com> | 2013-10-21 16:49:15 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-10-21 16:54:20 (GMT) |
commit | 4e184a21beda9de3703ecda94085c234f5bbd7da (patch) | |
tree | e127479207d0d9677d1713ba1eb08f6d26b3a768 /Source/cmStringCommand.cxx | |
parent | 9fb65d7090ca314cd8bfd88e52fefa6905938a6d (diff) | |
download | CMake-4e184a21beda9de3703ecda94085c234f5bbd7da.zip CMake-4e184a21beda9de3703ecda94085c234f5bbd7da.tar.gz CMake-4e184a21beda9de3703ecda94085c234f5bbd7da.tar.bz2 |
string: Add CONCAT sub-command
Add a string(CONCAT) command to simply concatenate input arguments
together. This will be useful for combining strings from different
quoting syntaxes. Add a RunCMake.string test covering these cases.
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r-- | Source/cmStringCommand.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 68ba13f..f9b69e3 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -73,6 +73,10 @@ bool cmStringCommand { return this->HandleLengthCommand(args); } + else if(subCommand == "CONCAT") + { + return this->HandleConcatCommand(args); + } else if(subCommand == "SUBSTRING") { return this->HandleSubstringCommand(args); @@ -768,6 +772,27 @@ bool cmStringCommand //---------------------------------------------------------------------------- bool cmStringCommand +::HandleConcatCommand(std::vector<std::string> const& args) +{ + if(args.size() < 2) + { + this->SetError("sub-command CONCAT requires at least one argument."); + return false; + } + + std::string const& variableName = args[1]; + std::string value; + for(unsigned int i = 2; i < args.size(); ++i) + { + value += args[i]; + } + + this->Makefile->AddDefinition(variableName.c_str(), value.c_str()); + return true; +} + +//---------------------------------------------------------------------------- +bool cmStringCommand ::HandleMakeCIdentifierCommand(std::vector<std::string> const& args) { if(args.size() != 3) |