ctest: Teach --build-options to allow zero options

The --build-options option consumes all following arguments until either
--build-target or --test-command.  Fix the logic to allow this to be
zero options.
This commit is contained in:
Brad King 2013-11-15 08:28:25 -05:00
parent 96966b5c80
commit 4d1d7725f3
1 changed files with 5 additions and 14 deletions

View File

@ -513,23 +513,14 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
{
this->BuildNoClean = true;
}
if(currentArg.find("--build-options",0) == 0 && idx < allArgs.size() - 1)
if(currentArg.find("--build-options",0) == 0)
{
++idx;
bool done = false;
while(idx < allArgs.size() && !done)
while(idx+1 < allArgs.size() &&
allArgs[idx+1] != "--build-target" &&
allArgs[idx+1] != "--test-command")
{
++idx;
this->BuildOptions.push_back(allArgs[idx]);
if(idx+1 < allArgs.size()
&& (allArgs[idx+1] == "--build-target" ||
allArgs[idx+1] == "--test-command"))
{
done = true;
}
else
{
++idx;
}
}
}
if(currentArg.find("--test-command",0) == 0 && idx < allArgs.size() - 1)