summaryrefslogtreecommitdiffstats
path: root/Source/cmAddDependenciesCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmAddDependenciesCommand.cxx')
-rw-r--r--Source/cmAddDependenciesCommand.cxx30
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;