Prechádzať zdrojové kódy

Optionally suppress errors in cmGeneratorExpression

Brad King 15 rokov pred
rodič
commit
ef9e9de0b8

+ 4 - 3
Source/cmGeneratorExpression.cxx

@@ -17,8 +17,8 @@
 //----------------------------------------------------------------------------
 cmGeneratorExpression::cmGeneratorExpression(
   cmMakefile* mf, const char* config,
-  cmListFileBacktrace const& backtrace):
-  Makefile(mf), Config(config), Backtrace(backtrace)
+  cmListFileBacktrace const& backtrace, bool quiet):
+  Makefile(mf), Config(config), Backtrace(backtrace), Quiet(quiet)
 {
   this->TargetInfo.compile("^\\$<TARGET"
                            "(|_SONAME|_LINKER)"  // File with what purpose?
@@ -87,7 +87,7 @@ bool cmGeneratorExpression::Evaluate()
     this->Data.insert(this->Data.end(), result.begin(), result.end());
     return true;
     }
-  else
+  else if(!this->Quiet)
     {
     // Failure.  Report the error message.
     cmOStringStream e;
@@ -99,6 +99,7 @@ bool cmGeneratorExpression::Evaluate()
                      this->Backtrace);
     return false;
     }
+  return true;
 }
 
 //----------------------------------------------------------------------------

+ 3 - 1
Source/cmGeneratorExpression.h

@@ -32,7 +32,8 @@ class cmGeneratorExpression
 public:
   /** Construct with an evaluation context and configuration.  */
   cmGeneratorExpression(cmMakefile* mf, const char* config,
-                        cmListFileBacktrace const& backtrace);
+                        cmListFileBacktrace const& backtrace,
+                        bool quiet = false);
 
   /** Evaluate generator expressions in a string.  */
   const char* Process(std::string const& input);
@@ -41,6 +42,7 @@ private:
   cmMakefile* Makefile;
   const char* Config;
   cmListFileBacktrace const& Backtrace;
+  bool Quiet;
   std::vector<char> Data;
   std::stack<size_t> Barriers;
   cmsys::RegularExpression TargetInfo;