소스 검색

ENH: if output variable turn verbose off

Bill Hoffman 23 년 전
부모
커밋
48b74fd034
2개의 변경된 파일13개의 추가작업 그리고 4개의 파일을 삭제
  1. 9 2
      Source/cmExecProgramCommand.cxx
  2. 4 2
      Source/cmExecProgramCommand.h

+ 9 - 2
Source/cmExecProgramCommand.cxx

@@ -49,6 +49,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args)
         return false;
         }
       output_variable = args[i];
+      haveoutput_variable = false;
       count ++;
       }
     else if(args[i] == "RETURN_VALUE")
@@ -66,6 +67,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args)
         return false;
         }
       return_variable = args[i];
+      havereturn_variable = false;
       count ++;
       }
     else if(args[i] == "ARGS")
@@ -94,17 +96,22 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args)
     {
     command = args[0];
     }
+  bool verbose = true;
+  if(output_variable.size() > 0)
+    {
+    verbose = false;
+    }
   int retVal = 0;
   std::string output;
   if(args.size() - count == 2)
     {
     cmSystemTools::MakeDirectory(args[1].c_str());
     cmSystemTools::RunCommand(command.c_str(), output, retVal,
-                              cmSystemTools::ConvertToOutputPath(args[1].c_str()).c_str());
+                              cmSystemTools::ConvertToOutputPath(args[1].c_str()).c_str(), verbose);
     }
   else
     {
-    cmSystemTools::RunCommand(command.c_str(), output, retVal);
+    cmSystemTools::RunCommand(command.c_str(), output, retVal, 0, verbose);
     }
 
   if ( output_variable.size() > 0 )

+ 4 - 2
Source/cmExecProgramCommand.h

@@ -69,8 +69,10 @@ public:
       "can include arguments if it is double quoted, but it is better to use the "
       "optional ARGS argument to specify arguments to the program.   This is because "
       "cmake will then be able to escape spaces in the Executable path.  An optiona "
-      "argument OUPUT_VARIABLE specifies a variable to which the output will be set. "
-      "To capture the return value of the execution, use RETURN_VALUE variable.";
+      "argument OUTPUT_VARIABLE specifies a variable to which the output will be set. "
+      "To capture the return value of the execution, use RETURN_VALUE variable. "
+      "If OUTPUT_VARIABLE is specified, then no output will go to the stdout/stderr "
+      "of the console running cmake.";
     }
   
   cmTypeMacro(cmExecProgramCommand, cmCommand);