diff options
author | Asit Dhal <dhal.asitk@gmail.com> | 2019-09-15 17:11:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-18 18:18:46 (GMT) |
commit | 9dba84cfa5e85e51ee6d6799f03a26656063ef8b (patch) | |
tree | 22fb29536def399e2ab763ac202a52467d45d7e2 /Source/cmAddDependenciesCommand.cxx | |
parent | 1423507a71199fd76b457ad9b215a6caca70ee58 (diff) | |
download | CMake-9dba84cfa5e85e51ee6d6799f03a26656063ef8b.zip CMake-9dba84cfa5e85e51ee6d6799f03a26656063ef8b.tar.gz CMake-9dba84cfa5e85e51ee6d6799f03a26656063ef8b.tar.bz2 |
Refactor: Use cmStrCat to construct error strings
Replace string construction using std::stringstream with cmStrCat and
cmWrap.
Diffstat (limited to 'Source/cmAddDependenciesCommand.cxx')
-rw-r--r-- | Source/cmAddDependenciesCommand.cxx | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index 0ddbda8..b1fc893 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -2,12 +2,11 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmAddDependenciesCommand.h" -#include <sstream> - #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmRange.h" +#include "cmStringAlgorithms.h" #include "cmTarget.h" bool cmAddDependenciesCommand(std::vector<std::string> const& args, @@ -21,10 +20,10 @@ bool cmAddDependenciesCommand(std::vector<std::string> const& args, cmMakefile& mf = status.GetMakefile(); std::string const& target_name = args[0]; if (mf.IsAlias(target_name)) { - std::ostringstream e; - e << "Cannot add target-level dependencies to alias target \"" - << target_name << "\".\n"; - mf.IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf.IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Cannot add target-level dependencies to alias target \"", + target_name, "\".\n")); } if (cmTarget* target = mf.FindTargetToUse(target_name)) { @@ -33,14 +32,17 @@ bool cmAddDependenciesCommand(std::vector<std::string> const& args, target->AddUtility(arg, &mf); } } else { - std::ostringstream e; - e << "Cannot add target-level dependencies to non-existent target \"" - << target_name << "\".\n" - << "The add_dependencies works for top-level logical targets created " - << "by the add_executable, add_library, or add_custom_target commands. " - << "If you want to add file-level dependencies see the DEPENDS option " - << "of the add_custom_target and add_custom_command commands."; - mf.IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf.IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat( + "Cannot add target-level dependencies to non-existent " + "target \"", + target_name, + "\".\nThe add_dependencies works for " + "top-level logical targets created by the add_executable, " + "add_library, or add_custom_target commands. If you want to add " + "file-level dependencies see the DEPENDS option of the " + "add_custom_target and add_custom_command commands.")); } return true; |