mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-22 06:59:01 -06:00
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.
This commit is contained in:
@@ -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);
|
||||
@@ -766,6 +770,27 @@ bool cmStringCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user