CTest: Allow -Dvar=value with no space between the D and the var

Similar to CMake's handling of -D command line arguments, for
consistency and to avoid silent ignoring of "unknown command
line" args.
This commit is contained in:
David Cole 2012-06-24 08:11:52 -04:00
parent 93d084c180
commit c77b57ba7d
1 changed files with 11 additions and 0 deletions

View File

@ -2289,6 +2289,17 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output)
} }
} }
// If it's not exactly -D, but it starts with -D, then try to parse out
// a variable definition from it, same as CMake does. Unsuccessful
// attempts are simply ignored since previous ctest versions ignore
// this too. (As well as many other unknown command line args.)
//
if(arg != "-D" && cmSystemTools::StringStartsWith(arg.c_str(), "-D"))
{
std::string input = arg.substr(2);
this->AddVariableDefinition(input);
}
if(this->CheckArgument(arg, "-T", "--test-action") && if(this->CheckArgument(arg, "-T", "--test-action") &&
(i < args.size() -1) ) (i < args.size() -1) )
{ {