1
0
Эх сурвалжийг харах

Merge topic 'message-stdstring'

186d9b083d cmSystemTools::Message: Add overload accepting std::string

Acked-by: Kitware Robot <[email protected]>
Merge-request: !2869
Brad King 7 жил өмнө
parent
commit
90ac5e6384

+ 2 - 2
Source/cmCallVisualStudioMacro.cxx

@@ -46,7 +46,7 @@ static bool LogErrorsAsMessages;
                      << std::endl;                                            \
         _hresult_oss.flags(std::ios::dec);                                    \
         _hresult_oss << __FILE__ << "(" << __LINE__ << ")";                   \
-        cmSystemTools::Message(_hresult_oss.str().c_str());                   \
+        cmSystemTools::Message(_hresult_oss.str());                           \
       }                                                                       \
     }
 
@@ -446,7 +446,7 @@ int cmCallVisualStudioMacro::CallMacro(const std::string& slnFile,
   if (err && LogErrorsAsMessages) {
     std::ostringstream oss;
     oss << "cmCallVisualStudioMacro::CallMacro failed, err = " << err;
-    cmSystemTools::Message(oss.str().c_str());
+    cmSystemTools::Message(oss.str());
   }
 
   return 0;

+ 1 - 1
Source/cmComputeLinkInformation.cxx

@@ -1282,7 +1282,7 @@ void cmComputeLinkInformation::DropDirectoryItem(std::string const& item)
     << "\" requests linking to directory \"" << item << "\".  "
     << "Targets may link only to libraries.  "
     << "CMake is dropping the item.";
-  cmSystemTools::Message(e.str().c_str());
+  cmSystemTools::Message(e.str());
 }
 
 void cmComputeLinkInformation::ComputeFrameworkInfo()

+ 1 - 1
Source/cmFLTKWrapUICommand.cxx

@@ -117,7 +117,7 @@ void cmFLTKWrapUICommand::FinalPass()
     msg += ".  The problem was found while processing the source directory: ";
     msg += this->Makefile->GetCurrentSourceDirectory();
     msg += ".  This FLTK_WRAP_UI call will be ignored.";
-    cmSystemTools::Message(msg.c_str(), "Warning");
+    cmSystemTools::Message(msg, "Warning");
     return;
   }
 }

+ 3 - 3
Source/cmGhsMultiTargetGenerator.cxx

@@ -67,7 +67,7 @@ void cmGhsMultiTargetGenerator::Generate()
     case cmStateEnums::SHARED_LIBRARY: {
       std::string msg = "add_library(<name> SHARED ...) not supported: ";
       msg += this->Name;
-      cmSystemTools::Message(msg.c_str());
+      cmSystemTools::Message(msg);
       return;
     }
     case cmStateEnums::OBJECT_LIBRARY: {
@@ -84,13 +84,13 @@ void cmGhsMultiTargetGenerator::Generate()
     case cmStateEnums::MODULE_LIBRARY: {
       std::string msg = "add_library(<name> MODULE ...) not supported: ";
       msg += this->Name;
-      cmSystemTools::Message(msg.c_str());
+      cmSystemTools::Message(msg);
       return;
     }
     case cmStateEnums::UTILITY: {
       std::string msg = "add_custom_target(<name> ...) not supported: ";
       msg += this->Name;
-      cmSystemTools::Message(msg.c_str());
+      cmSystemTools::Message(msg);
       return;
     }
     default:

+ 1 - 1
Source/cmGlobalGenerator.cxx

@@ -1060,7 +1060,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
   if (preference < 0) {
     std::string msg = linkerPrefVar;
     msg += " is negative, adjusting it to 0";
-    cmSystemTools::Message(msg.c_str(), "Warning");
+    cmSystemTools::Message(msg, "Warning");
     preference = 0;
   }
 

+ 1 - 1
Source/cmGlobalGhsMultiGenerator.cxx

@@ -70,7 +70,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
       "Green Hills MULTI: -T <toolset> not specified; defaulting to \"";
     message += tsp;
     message += "\"";
-    cmSystemTools::Message(message.c_str());
+    cmSystemTools::Message(message);
 
     /* store the full toolset for later use
      * -- already done if -T<toolset> was specified

+ 2 - 2
Source/cmGlobalVisualStudioGenerator.cxx

@@ -268,7 +268,7 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros()
         std::ostringstream oss;
         oss << "Could not copy from: " << src << std::endl;
         oss << "                 to: " << dst << std::endl;
-        cmSystemTools::Message(oss.str().c_str(), "Warning");
+        cmSystemTools::Message(oss.str(), "Warning");
       }
     }
 
@@ -783,7 +783,7 @@ void RegisterVisualStudioMacros(const std::string& macrosFile,
           << "CMake needs to register Visual Studio macros when its macros"
           << " file is updated or when it detects that its current macros file"
           << " is no longer registered with Visual Studio." << std::endl;
-      cmSystemTools::Message(oss.str().c_str(), "Warning");
+      cmSystemTools::Message(oss.str(), "Warning");
 
       // Count them again now that the warning is over. In the case of a GUI
       // warning, the user may have gone to close Visual Studio and then come

+ 1 - 1
Source/cmInstallCommand.cxx

@@ -712,7 +712,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
           std::ostringstream e;
           e << "INSTALL TARGETS - target " << target.GetName() << " has "
             << "RESOURCE files but no RESOURCE DESTINATION.";
-          cmSystemTools::Message(e.str().c_str(), "Warning");
+          cmSystemTools::Message(e.str(), "Warning");
         }
       }
     }

+ 1 - 1
Source/cmInstallTargetGenerator.cxx

@@ -51,7 +51,7 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
         << "\" has EXCLUDE_FROM_ALL set and will not be built by default "
         << "but an install rule has been provided for it.  CMake does "
         << "not define behavior for this case.";
-    cmSystemTools::Message(msg.str().c_str(), "Warning");
+    cmSystemTools::Message(msg.str(), "Warning");
   }
 
   // Perform the main install script generation.

+ 2 - 2
Source/cmLocalGenerator.cxx

@@ -2771,7 +2771,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
         << "CMake is dropping a preprocessor definition: " << define << "\n"
         << "Consider defining the macro in a (configured) header file.\n";
       /* clang-format on */
-      cmSystemTools::Message(e.str().c_str());
+      cmSystemTools::Message(e.str());
       return false;
     }
   }
@@ -2786,7 +2786,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
       << "CMake is dropping a preprocessor definition: " << define << "\n"
       << "Consider defining the macro in a (configured) header file.\n";
     /* clang-format on */
-    cmSystemTools::Message(e.str().c_str());
+    cmSystemTools::Message(e.str());
     return false;
   }
 

+ 3 - 3
Source/cmMakefile.cxx

@@ -322,7 +322,7 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
     msg << " ";
   }
   msg << ")";
-  cmSystemTools::Message(msg.str().c_str());
+  cmSystemTools::Message(msg.str());
 }
 
 // Helper class to make sure the call stack is valid.
@@ -1622,7 +1622,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf)
   if (this->GetCMakeInstance()->GetDebugOutput()) {
     std::string msg = "   Entering             ";
     msg += currentStart;
-    cmSystemTools::Message(msg.c_str());
+    cmSystemTools::Message(msg);
   }
 
   std::string const currentStartFile = currentStart + "/CMakeLists.txt";
@@ -1665,7 +1665,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf)
   if (this->GetCMakeInstance()->GetDebugOutput()) {
     std::string msg = "   Returning to         ";
     msg += this->GetCurrentSourceDirectory();
-    cmSystemTools::Message(msg.c_str());
+    cmSystemTools::Message(msg);
   }
 }
 

+ 1 - 1
Source/cmMakefileTargetGenerator.cxx

@@ -403,7 +403,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
     err << "Warning: Source file \"" << source.GetFullPath()
         << "\" is listed multiple times for target \""
         << this->GeneratorTarget->GetName() << "\".";
-    cmSystemTools::Message(err.str().c_str(), "Warning");
+    cmSystemTools::Message(err.str(), "Warning");
     return;
   }
 

+ 1 - 1
Source/cmMessageCommand.cxx

@@ -70,7 +70,7 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
     if (status) {
       this->Makefile->DisplayStatus(message.c_str(), -1);
     } else {
-      cmSystemTools::Message(message.c_str());
+      cmSystemTools::Message(message);
     }
   }
   if (fatal) {

+ 2 - 2
Source/cmMessenger.cxx

@@ -124,9 +124,9 @@ void displayMessage(MessageType t, std::ostringstream& msg)
   if (t == MessageType::FATAL_ERROR || t == MessageType::INTERNAL_ERROR ||
       t == MessageType::DEPRECATION_ERROR || t == MessageType::AUTHOR_ERROR) {
     cmSystemTools::SetErrorOccured();
-    cmSystemTools::Message(msg.str().c_str(), "Error");
+    cmSystemTools::Message(msg.str(), "Error");
   } else {
-    cmSystemTools::Message(msg.str().c_str(), "Warning");
+    cmSystemTools::Message(msg.str(), "Warning");
   }
 }
 

+ 2 - 2
Source/cmSystemTools.cxx

@@ -267,14 +267,14 @@ void cmSystemTools::Error(const char* m1, const char* m2, const char* m3,
     message += m4;
   }
   cmSystemTools::s_ErrorOccured = true;
-  cmSystemTools::Message(message.c_str(), "Error");
+  cmSystemTools::Message(message, "Error");
 }
 
 void cmSystemTools::Error(const std::string& m)
 {
   std::string message = "CMake Error: " + m;
   cmSystemTools::s_ErrorOccured = true;
-  cmSystemTools::Message(message.c_str(), "Error");
+  cmSystemTools::Message(message, "Error");
 }
 
 void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData)

+ 4 - 0
Source/cmSystemTools.h

@@ -76,6 +76,10 @@ public:
    * Display a message.
    */
   static void Message(const char* m, const char* title = nullptr);
+  static void Message(const std::string& m, const char* title = nullptr)
+  {
+    Message(m.c_str(), title);
+  }
 
   typedef void (*OutputCallback)(const char*, size_t length, void*);
 

+ 1 - 1
Source/cmUtilitySourceCommand.cxx

@@ -40,7 +40,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
       msg += ". If your intention is to run this executable, you need to "
              "preload the cache with the full path to a version of that "
              "program, which runs on this build machine.";
-      cmSystemTools::Message(msg.c_str(), "Warning");
+      cmSystemTools::Message(msg, "Warning");
     }
   } else {
     cmState* state = this->Makefile->GetState();

+ 1 - 1
Source/cmake.cxx

@@ -1252,7 +1252,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
   for (SaveCacheEntry const& i : saved) {
     this->AddCacheEntry(i.key, i.value.c_str(), i.help.c_str(), i.type);
   }
-  cmSystemTools::Message(warning.str().c_str());
+  cmSystemTools::Message(warning.str());
   // avoid reconfigure if there were errors
   if (!cmSystemTools::GetErrorOccuredFlag()) {
     // re-run configure