summaryrefslogtreecommitdiff
path: root/Source/cmAddDependenciesCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-03-29 14:53:36 -0400
committerBrad King <brad.king@kitware.com>2013-03-29 15:00:33 -0400
commitde13d68d11b9f8f08c67b8cbcdd0f957d5bae6e1 (patch)
treefc2627f441f17a82542faef7891815732e294b76 /Source/cmAddDependenciesCommand.cxx
parent1f16bd24ee00bfdb5d50e24eaa46da2cdfa1b129 (diff)
downloadcmake-de13d68d11b9f8f08c67b8cbcdd0f957d5bae6e1.tar.gz
add_dependencies: Distinguish target v. file dependencies in error (#14050)
When called with a non-existent LHS target name the user may be trying to add file-level dependencies. Clarify the error message to explain the difference between target-level and file-level dependencies. Point the reader at the commands and options needed for the latter.
Diffstat (limited to 'Source/cmAddDependenciesCommand.cxx')
-rw-r--r--Source/cmAddDependenciesCommand.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index a77140d611..04a304e391 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -35,10 +35,14 @@ bool cmAddDependenciesCommand
}
else
{
- std::string error = "Adding dependency to non-existent target: ";
- error += target_name;
- this->SetError(error.c_str());
- return false;
+ cmOStringStream 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.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}
return true;