diff options
author | Brad King <brad.king@kitware.com> | 2019-01-29 14:16:56 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-29 14:17:51 (GMT) |
commit | 90ac5e6384735deb0ac523684010b2f4701d4f4d (patch) | |
tree | 2c12e634eb7c95d4dfdf0221ae1e6b99f531b7b2 | |
parent | e7be5638a04ad6e47aafaed29139c6382fdea1cb (diff) | |
parent | 186d9b083db0e3fc77d9d92821e3cf45e06271da (diff) | |
download | CMake-90ac5e6384735deb0ac523684010b2f4701d4f4d.zip CMake-90ac5e6384735deb0ac523684010b2f4701d4f4d.tar.gz CMake-90ac5e6384735deb0ac523684010b2f4701d4f4d.tar.bz2 |
Merge topic 'message-stdstring'
186d9b083d cmSystemTools::Message: Add overload accepting std::string
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2869
-rw-r--r-- | Source/cmCallVisualStudioMacro.cxx | 4 | ||||
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 2 | ||||
-rw-r--r-- | Source/cmFLTKWrapUICommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmInstallCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMessageCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmMessenger.cxx | 4 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 4 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 4 | ||||
-rw-r--r-- | Source/cmUtilitySourceCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 |
18 files changed, 30 insertions, 26 deletions
diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index ecfcfb9..ee5feee 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/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; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index c68bb21..3d61665 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/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() diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index effb446..4b14d26 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/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; } } diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 19605e4..c253937 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/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: diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 04af013..58d0971 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/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; } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 7963c8a..bb8b772 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/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 diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index cbea3dd..e3dd2f9 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/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 diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index c6f4064..8ef6441 100644 --- a/Source/cmInstallCommand.cxx +++ b/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"); } } } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index d1d4316..3497814 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/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. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1122924..24bc7fa 100644 --- a/Source/cmLocalGenerator.cxx +++ b/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; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b59a733..9bd3b01 100644 --- a/Source/cmMakefile.cxx +++ b/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); } } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0fad233..af34169 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/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; } diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 4c26c66..95f5fcb 100644 --- a/Source/cmMessageCommand.cxx +++ b/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) { diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx index 3d788f6..1d790e2 100644 --- a/Source/cmMessenger.cxx +++ b/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"); } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a16460f..f7de3aa 100644 --- a/Source/cmSystemTools.cxx +++ b/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) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b30e4f7..b1d5751 100644 --- a/Source/cmSystemTools.h +++ b/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*); diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index f374626..231bca4 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/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(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 10cbb6e..6127094 100644 --- a/Source/cmake.cxx +++ b/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 |