Browse Source

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.
Brad King 12 years ago
parent
commit
4d1d7725f3
1 changed files with 5 additions and 14 deletions
  1. 5 14
      Source/CTest/cmCTestBuildAndTestHandler.cxx

+ 5 - 14
Source/CTest/cmCTestBuildAndTestHandler.cxx

@@ -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)